Team presentation readiness¶
UBrickleafTeamSubsystem::OnTeamChanged is a presentation-only event. Existing Blueprint bindings and parameters are unchanged. Team cache/index updates remain immediate, but the lifecycle subsystem holds the notification until UTankUISubsystem::IsWidgetControllerReadyForPlayerState succeeds.
The UI subsystem latches readiness before each local/remote widget-controller-ready broadcast. Its query also verifies that the controller and both view models still exist. Readiness is cleared on PlayerState removal and UI tracking resets. This works when UI readiness precedes the team change as well as when team replication arrives first.
The lifecycle queue uses weak PlayerState references, not pawns. Multiple changes while waiting are coalesced into one notification carrying the current MatchTeamId and current local-ownership flag. Pending notifications are removed before broadcasting to allow reentrant team changes. PlayerState removal, world teardown/cleanup, and subsystem deinitialization cancel pending notifications. Dedicated servers do not emit this presentation event.
Runtime verification checklist¶
- Late-joining client: receive remote team replication before UI readiness; no team event until that remote controller and view models are ready.
- UI-first arrival: change a ready player's team; receive the event immediately.
- Change teams several times before readiness; receive one notification with the latest team.
- Remove a player before readiness; no later notification for that PlayerState.
- Travel/rehost with pending changes; no source-world notification in the destination.
- Listen host and standalone: local UI readiness releases pending notifications without requiring a controller replication callback.
- Dedicated server: team cache/indexing still updates, but no presentation event is emitted.
The guarantee applies at synchronous dispatch time, not to a controller reference retained across later travel or removal. Widget-ready does not imply pawn-ready or that arbitrary Blueprint listeners have finished their own setup.