Usage

Alright, lets get to actually using UWB.

Platform Support

UWB aims to support all desktop platforms (Windows, Linux, MacOS). The core currently does support all desktop platforms, however you will have to factor in what engine you want to use. Each engine has their own different platform support. See the engine page for each engine's platform support.

WARNING

UWB does NOT support IL2CPP!

UWB does however support being code trimmed.

Components

By default, UWB provides two different components for handling web viewing from a RawImage:

While both of these components are fundamentally the same (they both inherit from BaseUwbClientManager), the WebBrowserUIFull has an additional FullscreenHandler for users who want fullscreen controls.

A WebBrowserUIControls components is also provided, to wrap around some methods provided in WebBrowserClient and expose them to Unity's UI system.

Options

Most options that you will ever need is in the WebBrowserClient, which is the core class for interfacing with UWB.

A lot options are exposed in the editor.

Web Browser Basic

The options are all very self-explanatory. If you need more info about one, hover over it for it's tooltip. Some options are explained in more details further along in the docs.

For calling methods on the engine (such as going back/forward/refresh, loading HTML, executing JS, etc...) are provided by the WebBrowserClient (see the API docs for a full reference). Any component that inherits from BaseUwbClientManager will have the WebBrowserClient exposed via browserClient field.

Some example code of loading a website from a method would look like:

using UnityEngine;
using VoltstroStudios.UnityWebBrowser.Core;

public class ExampleLoadingSite : MonoBehaviour
{
    //SerializeField exposes the control in Unity
    [SerializeField] private BaseUwbClientManager clientManager;
        
    private WebBrowserClient webBrowserClient;

    private void Start()
    {
        //Makes life easier having a local reference to WebBrowserClient
        webBrowserClient = clientManager.browserClient;
    }

    //Call this from were ever, and it will load 'https://voltstro.dev'
    public void LoadMySite()
    {
        webBrowserClient.LoadUrl("https://voltstro.dev");
    }
}

Samples

You can import one of the samples UWB includes via the package manager. Open the Package Manager and go to the UWB package, you will see the samples and be able to import them into your project.

UPM Sample