Search code examples
unity-game-engineandroid-webview

How to set full Screen size to Android WebView in Unity


How to set full Screen size to Android WebView in Unity I want to open it full size and I don't know how it would be done?


Solution

  • A frame is a combination of an origin (where it should be) and a size (how large it should be).

    The coordinate system used in UniWebView is top-left based. The zero point (0, 0) in the coordinate is the most top-left point of your screen. And the size is defined by Unity Screen, with Screen.width and Screen.height as its max: enter image description here

    In this coordinate system, you could set the position and size of the web view quite easy:

    webView.Frame = new Rect(0, 0, Screen.width, Screen.height);