By now, you might be aware of NPSettings. In-case if its new to you, read this post.
In your Unity project, If Webview is not enabled, enable by below steps.
- Open NPSettings and select Application Settings.
- Under supported features section, Enable Uses Webview checkbox and Save (see button at bottom).
Just drag the WebView prefab on to your scene hierarchy and refer that instance from your source code. You can set the frame and other properties of Webview with in the inspector.
- Can Hide - Set this to on if you allow this to hide. If not set, the view will be visible until developer closes it.
- Can Bounce - Setting for webpage bounce.
- Conrol Type - This sets how the user controls(close/navigation) to be shown.
- TOOLBAR - This shows forward/backward/reload/close controls for page navigation.
- CLOSE BUTTON - This shows close button at top-right corner to close the webview.
- NO CONTROLS - No controls will be shown. Developer needs to close this window.
- Show Spinner On Load - Set this to on if you need loading spinner while loading a page.
- Auto Show On Load Finish - Set this to on to auto show webview once loading is finished.
- Scales Page To Fit - This fits the page to the window size.
- Frame - Sets top-left position along with width and height. If dimensions are set -1, it takes full screen size.
- Background Color - Background color of webview.
For setting full screen by default, set width and height as -1
Additional Requirements on Android
Android needs below flags in root manifest file for Touch and Video Rendering.
//This enables touch in Webview < Unity 5.x. From Unity 5, touch is enabled by default. android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" //Required for enabling hardware rendering for videos. android:hardwareAccelerated="true"
Refer AndroidManifest_root_activity_settings_sample.txt for reference.