AGameModeBase::PlayerStateClass
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: UPROPERTYEditAnywhereNoClearBlueprintReadOnly
Description
The APlayerState subclass associated with every player and replicated to all clients. Use a custom subclass to store per-player data like score, team, and character selection.
Caveats & Gotchas
- • PlayerState is replicated to all clients — store only data that every machine legitimately needs. Avoid putting large or sensitive data here.
- • Marked NoClear; always keep a valid class set. PlayerState is recreated on the new server during seamless travel, so initialize defaults in BeginPlay rather than the constructor.
Signature
UPROPERTY(EditAnywhere, NoClear, BlueprintReadOnly, Category=Classes)
TSubclassOf<APlayerState> PlayerStateClass Example
Read PlayerStateClass from the active game mode
Blueprint
See Also
Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?