AGameStateBase::GameModeClass
#include "GameFramework/GameStateBase.h"
Access: public
Specifiers: UPROPERTYTransientBlueprintReadOnlyReplicatedUsing=OnRep_GameModeClass
Description
The class of the server's game mode, assigned by GameModeBase during initialization. Replicated to clients so they know which game mode is running even though they don't have a live instance.
Caveats & Gotchas
- • On non-authority clients the actual `AuthorityGameMode` instance is NULL — `GameModeClass` is the only way a client can identify what game mode is active.
- • Changes after initial replication trigger `OnRep_GameModeClass`, which calls `ReceivedGameModeClass`. Override that callback (not this property) to react to the class arriving on clients.
Signature
UPROPERTY(Transient, BlueprintReadOnly, Category=GameState, ReplicatedUsing=OnRep_GameModeClass)
TSubclassOf<AGameModeBase> GameModeClass Example
Check game mode class on a client C++
AGameStateBase* GS = GetWorld()->GetGameState();
if (GS && GS->GameModeClass)
{
UE_LOG(LogTemp, Log, TEXT("Game mode class: %s"), *GS->GameModeClass->GetName());
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?