Loom UI
LoomUI is the single component you add to a startup-scene GameObject. On
Awake it:
- Builds the
LoomViewand input capture used by the URP renderer and keeps them alive across scene loads. - Initializes the Loom runtime.
- In the Editor: spawns the Vite dev server and navigates the WebView once it’s ready.
- In player builds: loads the static UI from
Application.streamingAssetsPath/Loom/index.html.
Adding it to your scene
The quickest path is the menu:
Loom → Setup UI in Current Scene This adds a single Loom UI GameObject and installs LoomRendererFeature on
every renderer used by the project’s URP quality assets. Running the command
again is safe. It keeps an existing LoomUI component and installs any missing
renderer features.
If you add LoomUI manually, run the setup menu afterward. It detects the
existing component and configures the URP renderers without adding another one.
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 UIBridge : LoomBridgeBase {
public int Score { get; set; } // public property → state
[BridgeAction] public void AddPoint() { Score += 1; } // tagged method → action
} The class must also be partial so the generator can add its registration
logic alongside your members. public properties are state and public Event<T> properties are events by convention; a method is an action only when
tagged [BridgeAction].
Accessing the bridge from gameplay code
The generator emits a static Instance property on your bridge class. Use
it from anywhere in your game:
UIBridge.Instance.Score = 10; Inspector fields
| Field | Notes |
|---|---|
| Enable Dev Tools | Editor-only, on by default. Enables the WebView devtools server on Play so you can attach a browser inspector via Loom → Open Browser DevTools. |
| Devtools Port | Port the devtools server listens on (default 6080). |
| Show Loading Cover | On by default. Shows an opaque overlay over the scene during cold start, faded out when the first UI frame paints, so the bare scene isn’t visible while the UI loads. |
| Loading Cover Color | Solid color for the cover (default black). Alpha is ignored, the cover is always fully opaque while shown. |
| Loading Cover Fade Seconds | Fade-out duration after the first frame paints (default 0.2). 0 = disappear instantly. |
Per-scene drivers
LoomUI persists for the game’s lifetime. Per-scene GameObjects can drive
scene-specific bridge state by accessing UIBridge.Instance directly:
public class GameplayLoomDriver : MonoBehaviour {
private void Start() {
UIBridge.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.