User Guide

Prerequisites

Unity Version

Unity Version Status
Unity 6 (6000.x) Recommended — fully tested with 6000.3.3f1
Unity 2022.3 LTS Supported (minimum)
Unity 2023.x Supported
Unity 2021.x or earlier Not supported

Scripting Backend

Backend Status
IL2CPP Recommended for all platforms
Mono Supported on desktop (Windows, macOS, Linux)

Platform Runtime Requirements

Platform Requirement Pre-installed?
Windows 10/11 WebView2 Runtime (Edge Chromium) Yes — ships with Windows 10 April 2018+ and all Windows 11
Android 7.0+ Android System WebView Yes — bundled since API 24, auto-updated via Play Store
iOS 14+ WKWebView (WebKit.framework) Yes — part of iOS
macOS 11+ WKWebView (WebKit.framework) Yes — part of macOS
Linux libwebkit2gtk-4.1 + libgtk-3 No — install via package manager

Linux install: sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0 (Ubuntu/Debian) or sudo dnf install webkit2gtk4.1 gtk3 (Fedora)


Installation

  1. Purchase and download Lightweight Browser from the Unity Asset Store
  2. In Unity, open Window → Package Manager
  3. Select My Assets, find Lightweight Browser, and click Import
  4. The package will appear under Packages in your project

Quick Start

Option A: Use the Sample Scene

  1. After importing, go to Package ManagerLightweight BrowserSamples
  2. Import the Basic Browser sample
  3. Open the imported BasicBrowserScene
  4. Press Play

Option B: Add to Any Scene

  1. Create an empty GameObject
  2. Add the Hexora → Lightweight Browser component
  3. Set Home URL in the Inspector (e.g. https://www.google.com)
  4. Press Play — a fullscreen browser with auto-generated Canvas appears

Inspector Reference

LightweightBrowser Component

Browser Settings

Field Description Default
Home URL The URL loaded on startup and when pressing Home https://www.google.com
Normalised Rect Browser position/size. Values 0–1 are normalised (percentage of screen). Values > 1 are absolute pixels. Set to (0,0,0,0) for fullscreen with auto toolbar offset. (0, 0, 0, 0)

Display

Field Description Default
Display Image Optional RawImage to render the web page into. If left empty, one is auto-created with a Canvas. None
Zoom Enabled Allow Ctrl+scroll (desktop) or pinch-to-zoom (mobile) false

Debugging

Field Description Default
Debugging Enabled Enable remote debugging (DevTools on Windows, Safari Web Inspector on Apple) false
Bridge Enabled Enable the JavaScript ↔ C# bridge system false
Debug Overlay Enabled Show the IMGUI debug overlay for bridge message inspection (requires Bridge Enabled) false

ScreenResizeHandler Component

Automatically detects screen resolution changes and resizes the browser to match. Add to the same GameObject as LightweightBrowser.

Field Description Default
Browser Reference to the LightweightBrowser (auto-detected if on same GameObject) Auto
Poll Interval How often to check for resolution changes (seconds) 0.15

Display Modes

Texture Mode (Default)

The web page is captured as a Texture2D and displayed on a Unity RawImage. This allows:

  • Unity UI elements to render on top of the browser
  • The browser to be part of the normal Unity UI layout
  • Mouse/keyboard input forwarding from Unity to the browser

Rect Configuration

The Normalised Rect field supports two modes:

Value Range Mode Example
0.0 – 1.0 Normalised — percentage of screen (0, 0.05, 1, 0.95) = full width, 95% height with 5% top offset
> 1 Absolute pixels (0, 56, 1920, 1024) = starts at Y=56px
(0, 0, 0, 0) Auto fullscreen — fills screen below the toolbar (56px offset) Default

From Inspector / UI

The sample BasicBrowserController provides a toolbar with:

  • URL bar — type a URL and press Enter or click Go
  • Back / Forward — browser history navigation
  • Reload — reload current page
  • Home — navigate to configured Home URL

From C# Script

using Hexora.LightweightBrowser;

public class MyScript : MonoBehaviour
{
    [SerializeField] private LightweightBrowser _browser;

    void Start()
    {
        _browser.LoadUrl("https://unity.com");
    }

    void OnGUI()
    {
        var wv = _browser.WebView;
        if (wv != null)
        {
            GUILayout.Label($"URL: {wv.CurrentUrl}");
            GUILayout.Label($"Title: {wv.Title}");
            GUILayout.Label($"Loading: {wv.IsLoading}");
        }
    }
}

URL Changed Events

void OnEnable()
{
    _browser.WebView.UrlChanged += OnUrlChanged;
    _browser.WebView.PageFinished += OnPageFinished;
    _browser.WebView.TitleChanged += OnTitleChanged;
}

void OnUrlChanged(string url) => Debug.Log($"Navigated to: {url}");
void OnPageFinished(string url) => Debug.Log($"Page loaded: {url}");
void OnTitleChanged(string title) => Debug.Log($"Title: {title}");

WebView may be null during Awake(). Subscribe in Start() or check with _browser.WebView?.UrlChanged += ....


Input Handling

On desktop platforms (Windows, macOS, Linux), the plugin captures the web page as a texture and forwards input events:

  • Mouse — click, move, scroll (forwarded based on RawImage position)
  • Keyboard — key down/up and character events (forwarded when browser has focus)

The InputForwarder component handles this automatically.


Remote Debugging

Windows

  1. Set Debugging Enabled = true in the Inspector
  2. Press Play
  3. Open edge://inspect in Microsoft Edge
  4. Your webview appears under “Other targets”

macOS / iOS

  1. Set Debugging Enabled = true
  2. Open Safari → Develop menu
  3. Select your app → web page

Android

  1. Set Debugging Enabled = true
  2. Open chrome://inspect in Chrome
  3. Your webview appears under “Remote Target”

Bridge Debug Overlay

When Bridge Enabled and Debug Overlay Enabled are both checked:

  • Press F12 (desktop) or triple-tap (mobile) to toggle
  • Shows all bridge messages in real-time with colour coding:
    • 🔵 Commands (C# → WebView)
    • 🟢 Events (WebView → C#)
    • 🟡 Calls (JS → C#)
    • 🟣 Responses
    • 🔴 Errors
  • Filter by text, clear buffer, copy to clipboard

Best Practices

  1. One browser per scene — Only one LightweightBrowser instance is supported.
  2. Destroy on scene unload — The native webview is destroyed in OnDestroy(). Automatic with LoadSceneMode.Single.
  3. DontDestroyOnLoad — If you need persistence across scenes, call DontDestroyOnLoad(gameObject).
  4. Thread safety — All IWebView methods must be called from the Unity main thread.
  5. URL scheme — Always use https://. http:// may be blocked on Android and iOS by default.