Navigation
API > API/Runtime > API/Runtime/Engine
GameState is a subclass of GameStateBase that behaves like a multiplayer match-based game. It is tied to functionality in GameMode.
| Name | AGameState |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/GameFramework/GameState.h |
| Include Path | #include "GameFramework/GameState.h" |
Syntax
UCLASS (MinimalAPI)
class AGameState : public AGameStateBase
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → AActor → AInfo → AGameStateBase → AGameState
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
AGameState
(
const FObjectInitializer& ObjectInitializer |
GameFramework/GameState.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ElapsedTime | int32 | Elapsed game time since match has started. | GameFramework/GameState.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void DefaultTimer() |
Called periodically, overridden by subclasses | GameFramework/GameState.h | |
FName GetMatchState() |
Returns the current match state, this is an accessor to protect the state machine flow | GameFramework/GameState.h | |
virtual bool IsMatchInProgress() |
Returns true if we're in progress | GameFramework/GameState.h | |
virtual void OnRep_ElapsedTime() |
Gives clients the chance to do something when time gets updates | GameFramework/GameState.h | |
virtual void OnRep_MatchState() |
Match state has changed | GameFramework/GameState.h | |
void SetMatchState
(
FName NewState |
Updates the match state and calls the appropriate transition functions, only valid on server | GameFramework/GameState.h |
Overridden from AGameStateBase
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual float GetPlayerRespawnDelay
(
AController* Controller |
Returns how much time needs to be spent before a player can respawn | GameFramework/GameState.h | |
virtual float GetPlayerStartTime
(
AController* Controller |
Returns the time that should be used as when a player started | GameFramework/GameState.h | |
virtual void HandleBeginPlay() |
Called by game mode to set the started play bool | GameFramework/GameState.h | |
virtual bool HasMatchEnded() |
Returns true if match is WaitingPostMatch or later | GameFramework/GameState.h | |
virtual bool HasMatchStarted() |
Returns true if the world has started match (called MatchStarted callbacks) | GameFramework/GameState.h | |
virtual void ReceivedGameModeClass() |
Called when the GameClass property is set (at startup for the server, after the variable has been replicated on clients) | GameFramework/GameState.h |
Overridden from AActor
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostInitializeComponents() |
Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay | GameFramework/GameState.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void HandleLeavingMap() |
Called when the match transitions to LeavingMap | GameFramework/GameState.h | |
virtual void HandleMatchHasEnded() |
Called when the map transitions to WaitingPostMatch | GameFramework/GameState.h | |
virtual void HandleMatchHasStarted() |
Called when the state transitions to InProgress | GameFramework/GameState.h | |
virtual void HandleMatchIsWaitingToStart() |
Called when the state transitions to WaitingToStart | GameFramework/GameState.h |