Skip to content
Version 2.32.0
↓ Get the launcher

WindowSpec.Prebuild property

Build this window ahead of its first open, at moments where a freeze doesn’t matter, so the first open is a plain re-show instead of a 100-400 ms build. Meant for big windows the player opens by hand (hubs, confirm dialogs, chat, meters) that start hidden. The window stays hidden throughout (IsShown false), never takes clicks or hover, and its z-order is untouched. Two stages, both framework-driven:

  1. Structure at the login / character-select screen: the element tree is built WITHOUT pulling any values. Only build-time callbacks run there (button Label/Icon, slider Get, the TitleProvider) — keep those free of game-state reads.
  2. Fill once in the world: one normal apply off-screen (every value lambda, Conditional and list), behind the world-entry loading screen when there is one. A window only registered in the world, or one the loading screen didn’t cover, is filled during play one window at a time, outside combat, seconds apart.

A window that is Visible but held hidden by ShouldRender and not drawn yet (a HUD waiting for a target or combat) gets the fill too, so its first DRAWN apply no longer builds its Conditionals and lists. The fill ignores ShouldRender (it runs while the window is hidden), so value lambdas must be safe whenever the world is up — the same contract as any shown window. Register the window at plugin start-up (not lazily on first use) so the structure stage can reach it. Costs the built tree’s memory for the session (a parked window keeps it anyway once opened). Default false = built on first open, as before. Init-only → binary-safe. Added in 2.30.0.

public bool Prebuild { get; set; }