loomgui.com ↗

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

AttributeUse
[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

TypeBehavior
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

MenuUse
Loom -> Setup UI in Current SceneAdds LoomUI and configures the project’s URP renderers
Loom -> Sync UI DependenciesInstalls bundled UI packages into the UI app
Loom -> Regenerate TypesRewrites generated TypeScript bridge files
Loom -> Restart Dev ServerRestarts the Vite dev server
Loom -> Open Browser DevToolsOpens browser DevTools for the live UI
Loom -> DoctorChecks the local Loom environment
Loom -> Build UI for PlayerRuns the production UI build