API reference Built-in Loom state
API reference

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#.

TSX
const bridge = useBridge();

bridge.loom.currentSceneName;
bridge.loom.viewportWidth;
bridge.loom.viewportHeight;
bridge.loom.devicePixelRatio;
bridge.loom.bridgeReady;

Fields

FieldTypeMeaning
currentSceneNamestringThe active Unity scene name
viewportWidthnumberCurrent UI viewport width in CSS pixels
viewportHeightnumberCurrent UI viewport height in CSS pixels
devicePixelRationumberCurrent device pixel ratio
bridgeReadybooleanWhether the bridge has completed startup

Usage

For example, select a compact layout when the game viewport is under 900 CSS pixels:

TSX
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.

Loom documentation

Search docs

Esc

Type a word or phrase to search the documentation.

Type a word or phrase to search the documentation.