loomgui.com ↗

Loom UI

LoomUI is the single component you add to a startup-scene GameObject. On Awake it:

  1. Builds the Loom Canvas + LoomView (with input capture) and marks them DontDestroyOnLoad so they survive scene loads.
  2. Initializes the Loom runtime.
  3. In the Editor: spawns the Vite dev server and navigates the WebView once it’s ready.
  4. In player builds: loads the static UI from Application.streamingAssetsPath/Loom/index.html.

Upgrading from v0.1, where you wrote your own bootstrap MonoBehaviour? See the v0.1 → v0.2 migration guide.

Adding it to your scene

The quickest path is the menu:

Loom → Setup UI in Current Scene

This adds a single Loom UI GameObject with the LoomUI component attached. Running it again on the same scene is safe; it skips setup if a LoomUI is already present.

Alternatively, add the LoomUI component manually to any GameObject in your startup scene.

Your bridge class

Your [Bridge] class must inherit LoomBridgeBase. The source generator requires this; it errors on classes that don’t:

using Loom;

[Bridge]
public partial class GameBridge : LoomBridgeBase {
  [BridgeState] public int Score { get; set; }
  [BridgeAction] public void AddPoint() { Score += 1; }
}

The class must also be partial so the generator can add its registration logic alongside your members.

Accessing the bridge from gameplay code

The generator emits a static Instance property on your bridge class. Use it from anywhere in your game:

GameBridge.Instance.Score = 10;

You no longer instantiate the bridge or call RegisterWithLoom() yourself; LoomUI handles both automatically on Awake.

Inspector fields

FieldNotes
Enable Dev ToolsEditor-only, on by default. Enables the WebView devtools server on Play so you can attach a browser inspector via Loom → Open Browser DevTools.
Devtools PortPort the devtools server listens on (default 6080).

Per-scene drivers

LoomUI persists for the game’s lifetime. Per-scene GameObjects can drive scene-specific bridge state by accessing GameBridge.Instance directly:

public class GameplayLoomDriver : MonoBehaviour {
  private void Start() {
    GameBridge.Instance.CurrentScreen = SampleScreen.Hud;
  }
}

Drivers attach to scene-specific GameObjects and clean up automatically on scene unload. No cross-reference to a bootstrap singleton needed.

Editor vs player

In the Editor, Loom auto-spawns Vite and navigates the UI for you once the dev server is ready. No extra setup needed.

In player builds, the UI is loaded from Application.streamingAssetsPath/Loom/index.html, which your last production UI build wrote. See Player builds.

Shutdown

LoomUI calls LoomRuntime.Shutdown() automatically when the component is destroyed (e.g. when the application quits). No manual teardown is needed. To also stop the Vite dev server mid-session, use Loom → Stop Dev Server.