Zum Hauptinhalt springen

Timers and Lifecycle

Unreal creates USurvivalSubSystem per Game Instance. Initialize reads settings. With server-only timers enabled, it immediately calls OnWorldReady(GetWorld). Otherwise it binds PostLoadMapWithWorld only if internal timers are enabled.

OnWorldReady stores WorldContext, enables external pulse mode and returns when internal timers are disabled. With internal timers enabled, it filters network mode if requested, creates four looping world timers, then creates/initializes CrossAffectManager. Manager creation is coupled to successful internal timer-path initialization; it is not guaranteed merely by subsystem existence.


Important Branches​

Default server-only filtering accepts ListenServer and DedicatedServer, not Standalone. The immediate Initialize path has no callback retry when GetWorld is null or not ready. External mode returns before manager creation. Disabling both internal timers and the server-only option leaves no world-ready call/hook, so external mode stays false.

UpdateHealthComponent/UpdateFoodComponent/UpdateStaminaComponent/UpdateTempComponent only broadcast in external mode. The four On*Update delegates are global pulses for subscribers, not per-Pawn operations. Each handler performs an amount per pulse; there is no DeltaTime scaling.


Lifetime​

Deinitialize clears subsystem timers only when bUseSubsystemTimers is true and GetWorld has an AuthGameMode. It does not explicitly remove the PostLoadMapWithWorld binding. OnWorldReady clears/recreates handles through the current WorldContext and keeps an already created manager, whose settings maps are not reloaded there.

Component code has no custom EndPlay override that explicitly unbinds every subscription/clears the health downed timer. UObject delegate/timer lifetime behavior does not by itself establish correctness across travel, mode changes or reset. Verify those transitions in Unreal and use deliberate project teardown where appropriate.

Source: Private/SurvivalSubSystem.cpp and Private/Components/*.cpp. See Timer Setup for the settings matrix.