Targeting + preview stability (5.0)
This guide is intentionally scoped to GridBuilding 5.0 and its node-first / state-first wiring. Later versions (5.1/6.0) improve this area by carrying small event payloads (EventData) and keeping service state private.
What this guide covers
- Why a placement preview is commonly cleared in 5.0
- Where targeting state lives (in the 5.0 mental model)
- What to check when “preview disappears” appears nondeterministic
This guide does NOT:
- Define new APIs
- Provide migration steps (see
v5-1/v6-0docs for forward guidance)
Mental model (5.0)
In 5.0, preview + targeting stability depends on the interaction between:
- the targeting node/system (which computes the current target)
- the preview / indicator nodes (which render the current target)
- the injector/container wiring (which decides who owns references and when nodes are re-injected)
When a preview clears unexpectedly, it is usually because one of these changed:
- the target changed to an invalid/unplaceable state
- the active mode/system changed (and the preview was reset as part of mode lifecycle)
- wiring/references were re-assigned (injector re-ran, scene reloaded, or nodes were re-instanced)
Debug checklist (5.0)
- Verify the mode did not change (build/manipulation/none) during the frame the preview clears.
- Verify the targeting computation did not yield “no valid target” (common at tile boundaries, rotation changes, or collision edge cases).
- Verify the injector/container did not re-inject or replace a node reference (scene reload, tool scripts, or re-instancing).
- If indicators clear but targeting remains stable, focus on the preview/indicator node lifecycle rather than the targeting system.