AGameStateBase::ReceivedSpectatorClass
#include "GameFramework/GameStateBase.h"
Access: public
Specifiers: virtual
Description
Called when the `SpectatorClass` property becomes valid — on the server during init and on clients after replication. Override to react to the spectator pawn class being established.
Caveats & Gotchas
- • This fires on the server during `PostInitializeComponents` before any clients connect; clients receive it later via `OnRep_SpectatorClass`. Code placed here may execute at very different times depending on net mode.
- • Do not cache `SpectatorClass` before this fires — the value is transient and may be invalid until this callback runs.
Signature
ENGINE_API virtual void ReceivedSpectatorClass() Return Type
void Example
Log spectator class arrival C++
void AMyGameState::ReceivedSpectatorClass()
{
Super::ReceivedSpectatorClass();
UE_LOG(LogGame, Log, TEXT("SpectatorClass ready: %s"), *GetNameSafe(SpectatorClass));
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?