Built-in Loom state
Read the loom.* state Loom maintains on every bridge.
Loom adds a read-only loom object to every bridge. You do not declare it in C#.
const bridge = useBridge();
bridge.loom.currentSceneName;
bridge.loom.viewportWidth;
bridge.loom.viewportHeight;
bridge.loom.devicePixelRatio;
bridge.loom.bridgeReady;
Fields
| Field | Type | Meaning |
|---|---|---|
currentSceneName | string | The active Unity scene name |
viewportWidth | number | Current UI viewport width in CSS pixels |
viewportHeight | number | Current UI viewport height in CSS pixels |
devicePixelRatio | number | Current device pixel ratio |
bridgeReady | boolean | Whether the bridge has completed startup |
Usage
For example, select a compact layout when the game viewport is under 900 CSS pixels:
const bridge = useBridge();
const compact = () => bridge.loom.viewportWidth < 900;
Ownership
Loom updates these fields when the active scene, viewport size, DPI, or bridge connection changes.