Stratkit Map Notification¶
Framework for transient, world-anchored UI shown on a shared world-space canvas — pool-backed, billboarded, screen-pixel scaled. Each notification kind lives in a consumer package (e.g. com.whs.map-notifications) and supplies its own prefab + request + spawner.
Choosing a base class¶
AFloatingMapNotificationBehaviour— code-driven kinds with a fade-in / hold / fade-out envelope and an optional off-screen-edge fade. Subclass overridesUpdateContent()for per-frame text/icon updates; alpha composition is owned by this base. Recommended starting point.AMapNotificationBehaviour— direct base. Use for Animator-driven kinds (the Animator writesCanvasGroup.alpha; callFinish()from an Animation Event), persistent button-closed kinds (setalpha = 1inSetup; bind a button toRequestClose), or any kind whose lifecycle / fade story doesn't match the floating envelope. Subclass overridesOnLateUpdate()and owns alpha.
Adding a new notification kind¶
Mirror an existing consumer subfolder (e.g. com.whs.map-notifications/Runtime/ArmyCommand/).
Lifecycle¶
- Spawn is two-step.
MapNotificationSpawnHelper.Spawn(...)returns a pooledGameObjectparented under the per-region canvas; the spawner then calls the subclass's strongly-typedSetup(...)(each kind'sSetupsignature differs, so a single-call shape isn't viable). - Push-close. Subclasses call
protected Finish()themselves when they're done — no "is finished" predicate on the base.Finishis idempotent.
Gotchas¶
AFloatingMapNotificationBehavioursealsOnLateUpdatefor envelope composition — subclasses extending it overrideUpdateContent(), notOnLateUpdate.- Default
ComputeScaleassumesRectTransform.sizeDeltais in natural screen pixels; prefabs withoutContentSizeFittermust override.