Web is the top-level static class for the module. It contains static methods for configuring the module and creating resources.
static void CreateTexture(float width, float height, Action<Texture2D> callback)
Creates a special texture that the webview can use for rendering.
Note that the
WebViewPrefab takes care of texture creation for you, so you only need to call this method directly if you create
IWebView instances outside of a prefab using
Texture creation occurs asynchronously in order to allow textures to be created on the render thread, and the provided callback is called once the texture has been created.
static IWebView CreateWebView()
Creates a new webview in a platform-agnostic way.
WebViewPrefab takes care of creating an
IWebView instance for you, so you only need to call this method directly if you need to create
IWebView instances outside of a prefab.
static void SetUserAgent(bool mobile)
By default, webviews use a User-Agent that looks that of a desktop computer so that servers return the desktop versions of websites. If you instead want the mobile versions of websites, you can invoke this method with
true to use the User-Agent for a mobile device.
static void SetUserAgent(string userAgent)
Configures the module to use a custom User-Agent string.