RealDocs

AGameModeBase::PlayerStateClass

property Engine Blueprint Since 4.14
#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
Event BeginPlay Cast To MyGameMode Object Cast Failed As My Game Mode As My Game Mode Is Valid Input Object Is Valid Is Not Valid Get Game Mode Return Value Get Player State Class Target is Game Mode Base Target Player State Class Player State Class
Edit Blueprint graph Read PlayerStateClass from the active game mode
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.