![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <GameStateBase.h>
Inheritance diagram for AGameStateBase:Public Attributes | |
| TSubclassOf< AGameModeBase > | GameModeClass |
| TObjectPtr< AGameModeBase > | AuthorityGameMode |
| TSubclassOf< ASpectatorPawn > | SpectatorClass |
| TArray< TObjectPtr< APlayerState > > | PlayerArray |
Protected Member Functions | |
| virtual ENGINE_API void | OnRep_GameModeClass () |
| virtual ENGINE_API void | OnRep_SpectatorClass () |
| virtual ENGINE_API void | OnRep_ReplicatedHasBegunPlay () |
| virtual ENGINE_API void | UpdateServerTimeSeconds () |
| virtual ENGINE_API void | OnRep_ReplicatedWorldTimeSecondsDouble () |
Friends | |
| class | UDemoNetDriver |
| class | FReplayHelper |
GameStateBase is a class that manages the game's global state, and is spawned by GameModeBase. It exists on both the client and the server and is fully replicated.
|
virtual |
Add PlayerState to the PlayerArray
Allow game states to react to asset packages being loaded asynchronously
| const AGameModeBase * AGameStateBase::GetDefaultGameMode | ( | ) | const |
Helper to return the default object of the GameModeBase class corresponding to this GameState. This object is not safe to modify.
|
inline |
Helper template to returns the GameModeBase default object cast to the right type
|
virtual |
|
virtual |
Returns how much time needs to be spent before a player can respawn
Reimplemented in AGameState.
|
virtual |
Returns the time that should be used as when a player started
Reimplemented in AGameState.
| APlayerState * AGameStateBase::GetPlayerStateFromUniqueNetId | ( | const FUniqueNetIdWrapper & | InPlayerId | ) | const |
Returns the player state for a specified unique player Id
|
virtual |
Returns the simulated TimeSeconds on the server, will be synchronized on client and server
|
virtual |
Called by game mode to set the started play bool
Reimplemented in AGameState.
|
virtual |
Returns true if the world has started play (called BeginPlay on actors)
|
virtual |
Returns true if the match can be considered ended. Defaults to false.
Reimplemented in AGameState.
|
virtual |
Returns true if the world has started match (called MatchStarted callbacks)
Reimplemented in AGameState.
|
protectedvirtual |
GameModeBase class notification callback.
|
protectedvirtual |
By default calls BeginPlay and StartMatch
|
protectedvirtual |
Allows clients to calculate ServerWorldTimeSecondsDelta
|
protectedvirtual |
Callback when we receive the spectator class
|
overridevirtual |
Reimplemented in AGameState.
|
virtual |
Called when the GameClass property is set (at startup for the server, after the variable has been replicated on clients)
Reimplemented in AGameState.
|
virtual |
Called when the SpectatorClass property is set (at startup for the server, after the variable has been replicated on clients)
|
virtual |
Remove PlayerState from the PlayerArray.
Called during seamless travel transition twice (once when the transition map is loaded, once when destination map is loaded)
|
protectedvirtual |
Called periodically to update ReplicatedWorldTimeSecondsDouble
|
friend |
|
friend |
| TObjectPtr<AGameModeBase> AGameStateBase::AuthorityGameMode |
Instance of the current game mode, exists only on the server. For non-authority clients, this will be NULL.
|
protected |
Replicated when GameModeBase->StartPlay has been called so the client will also start play
| TSubclassOf<AGameModeBase> AGameStateBase::GameModeClass |
Class of the server's game mode, assigned by GameModeBase.
|
protected |
The number of server world time deltas accumulated in SumServerWorldTimeSecondsDelta - used for computing the mean
| TArray<TObjectPtr<APlayerState> > AGameStateBase::PlayerArray |
Array of all PlayerStates, maintained on both server and clients (PlayerStates are always relevant)
|
protected |
Server TimeSeconds. Useful for syncing up animation and gameplay.
|
protected |
The difference from the local world's TimeSeconds and the server world's TimeSeconds.
|
protected |
How often the server updates the replicated TimeSeconds from the world. Values mean "update every X seconds", so 0.5 means update every half second. Set to zero to disable periodic updates.
| TSubclassOf<ASpectatorPawn> AGameStateBase::SpectatorClass |
Class used by spectators, assigned by GameModeBase.
|
protected |
Cumulative sum of computed server world time deltas for smoothed-averaging
|
protected |
Handle for efficient management of the UpdateServerTimeSeconds timer