Skip to content

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 overrides UpdateContent() 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 writes CanvasGroup.alpha; call Finish() from an Animation Event), persistent button-closed kinds (set alpha = 1 in Setup; bind a button to RequestClose), or any kind whose lifecycle / fade story doesn't match the floating envelope. Subclass overrides OnLateUpdate() 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 pooled GameObject parented under the per-region canvas; the spawner then calls the subclass's strongly-typed Setup(...) (each kind's Setup signature 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. Finish is idempotent.

Gotchas

  • AFloatingMapNotificationBehaviour seals OnLateUpdate for envelope composition — subclasses extending it override UpdateContent(), not OnLateUpdate.
  • Default ComputeScale assumes RectTransform.sizeDelta is in natural screen pixels; prefabs without ContentSizeFitter must override.