Guides Performance guidelines
Guides

Performance guidelines

Reduce unnecessary state updates, layout work, and asset-loading delays.

Push state deliberately

Assign a bridge property when the displayed value changes. For example, avoid reassigning the same health value every frame:

C#
if (Health != newHealth)
{
    Health = newHealth;
}

If a value changes faster than the player needs to see it, send it less often.

Update collections efficiently

If a screen only displays a count, send the count instead of the whole list. For frequent inserts and removals, use reactive collections. Use snapshots when you replace a collection in full. See State and collections for their semantics.

CSS and layout

  • Fullscreen filters can be expensive; profile them in the game.
  • Prefer animating transform and opacity when they produce the effect you need.
  • Group DOM measurements before style changes. Alternating reads and writes can force repeated layout calculations.

Fonts and assets

Bundle fonts with the UI so the game does not wait for a font download. See Fonts for the file location and CSS.

Measure before tuning

Use DevTools to find slow JavaScript, layout work, and failed asset requests. Use the Unity Profiler to measure the game’s frame time.

Loom documentation

Search docs

Esc

Type a word or phrase to search the documentation.

Type a word or phrase to search the documentation.