API reference
This is the compact reference. For learning-oriented explanations, use the Bridge and Unity integration sections.
Bridge class
[Bridge]
public partial class UIBridge : LoomBridgeBase
{
} - Must be
partial. - Must inherit
LoomBridgeBase. - Public properties and public
Event<T>properties are state and events by convention. Methods are actions only when tagged[BridgeAction].
Attributes
| Attribute | Use |
|---|---|
[Bridge] | Marks the root bridge class |
[BridgeAction] | Marks a method as a UI-callable action (root or nested DTO) |
[BridgeIgnore] | Keeps a public state/event member off the bridge |
[BridgeName("name")] | Overrides the UI-facing member name |
State
public int Score { get; set; }
public PlayerState Player { get; set; } = new(); Public properties are state. Assigning a property pushes the new value to the UI.
Actions
[BridgeAction] public void StartGame() {}
[BridgeAction] public PurchaseResult BuyItem(BuyItemRequest request) {} Methods tagged [BridgeAction] are actions (on the bridge root or a nested state
DTO). Actions can take any number of parameters and may return a value or Task<T>.
Events
public Event<DamageEvent> TookDamage { get; } = new(); Fire from C#:
TookDamage.Fire(payload); Listen from the UI:
onEvent('tookDamage', (payload) => {}); Collections
| Type | Behavior |
|---|---|
List<T> / T[] / Dictionary<K,V> | Snapshot; reassign to sync |
ReactiveList<T> / ReactiveMap<K,V> | Granular changes sync as they happen |
Built-in state
Every bridge has read-only loom.* state:
bridge.loom.currentSceneName
bridge.loom.viewportWidth
bridge.loom.viewportHeight
bridge.loom.devicePixelRatio
bridge.loom.bridgeReady Editor menus
| Menu | Use |
|---|---|
Loom -> Setup UI in Current Scene | Adds LoomUI and configures the project’s URP renderers |
Loom -> Sync UI Dependencies | Installs bundled UI packages into the UI app |
Loom -> Regenerate Types | Rewrites generated TypeScript bridge files |
Loom -> Restart Dev Server | Restarts the Vite dev server |
Loom -> Open Browser DevTools | Opens browser DevTools for the live UI |
Loom -> Doctor | Checks the local Loom environment |
Loom -> Build UI for Player | Runs the production UI build |