AGameStateBase::ReceivedGameModeClass
#include "GameFramework/GameStateBase.h"
Access: public
Specifiers: virtual
Description
Called when the `GameModeClass` property becomes valid — immediately on the server during initialization, and on clients once the replicated value arrives. Override to perform one-time setup that depends on knowing the game mode class.
Caveats & Gotchas
- • On the server this fires synchronously during `PostInitializeComponents`. On clients it fires inside `OnRep_GameModeClass` — the ordering relative to other replication callbacks is not guaranteed.
- • Always call `Super::ReceivedGameModeClass()` first; the base class may install timer callbacks or perform other bookkeeping that subclasses depend on.
Signature
ENGINE_API virtual void ReceivedGameModeClass() Return Type
void Example
Initialize client UI once game mode class is known C++
void AMyGameState::ReceivedGameModeClass()
{
Super::ReceivedGameModeClass();
if (IsNetMode(NM_Client))
{
UpdateHUDForGameMode(GameModeClass);
}
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?