![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <GameMode.h>
Inheritance diagram for AGameMode:Public Attributes | |
| uint32 | bDelayedStart: 1 |
| int32 | NumSpectators |
| int32 | NumPlayers |
| int32 | NumBots |
| float | MinRespawnDelay |
| int32 | NumTravellingPlayers |
| TSubclassOf< class ULocalMessage > | EngineMessageClass |
| TArray< TObjectPtr< class APlayerState > > | InactivePlayerArray |
Protected Member Functions | |
| virtual ENGINE_API void | SetMatchState (FName NewState) |
| virtual ENGINE_API void | OnMatchStateSet () |
| ENGINE_API void | K2_OnSetMatchState (FName NewState) |
| virtual ENGINE_API void | HandleMatchIsWaitingToStart () |
| ENGINE_API bool | ReadyToStartMatch () |
| virtual ENGINE_API void | HandleMatchHasStarted () |
| ENGINE_API bool | ReadyToEndMatch () |
| virtual ENGINE_API void | HandleMatchHasEnded () |
| virtual ENGINE_API void | HandleLeavingMap () |
| virtual ENGINE_API void | HandleMatchAborted () |
Protected Attributes | |
| FName | MatchState |
| float | InactivePlayerStateLifeSpan |
| int32 | MaxInactivePlayers |
| bool | bHandleDedicatedServerReplays |
GameMode is a subclass of GameModeBase that behaves like a multiplayer match-based game. It has default behavior for picking spawn points and match state. If you want a simpler base, inherit from GameModeBase instead.
|
virtual |
Add PlayerState to the inactive list, remove from the active list
Broadcast a string to all players.
|
virtual |
Broadcast a localized message to all players. Most message deal with 0 to 2 related PlayerStates. The LocalMessage class defines how the PlayerState's and optional actor are used.
|
virtual |
Attempt to find and associate an inactive PlayerState with entering PC.
@Returns true if a PlayerState was found and associated with PC.
|
virtual |
Get local address
|
overridevirtual |
|
overridevirtual |
|
virtual |
Return true if we want to travel_absolute, used by RestartGame by default
|
virtual |
Handles when a player is disconnected, before the session does
|
protectedvirtual |
Called when the match transitions to LeavingMap
|
protectedvirtual |
Called when the match transitions to Aborted
|
protectedvirtual |
Called when the map transitions to WaitingPostMatch
|
protectedvirtual |
Called when the state transitions to InProgress
|
protectedvirtual |
Called when the state transitions to WaitingToStart
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Returns true if the match state is WaitingPostMatch or later
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
protected |
Implementable event to respond to match state changes
|
overridevirtual |
|
virtual |
Called when a connection closes before getting to PostLogin()
| ConnectionUniqueId | the unique id on the connection, if known (may be very early and impossible to know) |
|
protectedvirtual |
Overridable virtual function to dispatch the appropriate transition functions before GameState and Blueprints get SetMatchState calls.
|
virtual |
Override PC's PlayerState with the values in OldPlayerState as part of the inactive player handling
|
overridevirtual |
| void AGameMode::PlayerSwitchedToSpectatorOnly | ( | APlayerController * | PC | ) |
Will remove the controller from the correct count then add them to the spectator count.
|
virtual |
Called from CommitMapChange after unloading previous level and loading new level+sublevels. Used for asynchronous level streaming
|
overridevirtual |
|
overridevirtual |
|
virtual |
Called from CommitMapChange before unloading previous level. Used for asynchronous level streaming
| PreviousMapName | - Name of the previous persistent level |
| NextMapName | - Name of the persistent level being streamed to |
|
protected |
Returns true if ready to End Match. Games should override this
|
protected |
Returns true if ready to Start Match. Games should override this
| void AGameMode::RemovePlayerControllerFromPlayerCount | ( | APlayerController * | PC | ) |
Removes the passed in player controller from the correct count for player/spectator/tranistioning
|
virtual |
Exec command to broadcast a string to all players
Updates the match state and calls the appropriate transition functions
|
virtual |
SetViewTarget of player control on server change
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
| uint32 AGameMode::bDelayedStart |
Whether the game should immediately start when the first player logs in. Affects the default behavior of ReadyToStartMatch
|
protected |
If true, dedicated servers will record replays when HandleMatchHasStarted/HandleMatchHasStopped is called
| TSubclassOf<class ULocalMessage> AGameMode::EngineMessageClass |
Contains strings describing localized game agnostic messages.
| TArray<TObjectPtr<class APlayerState> > AGameMode::InactivePlayerArray |
PlayerStates of players who have disconnected from the server (saved in case they reconnect)
|
protected |
Time a playerstate will stick around in an inactive state after a player logout
|
protected |
What match state we are currently in
|
protected |
The maximum number of inactive players before we kick the oldest ones out
| float AGameMode::MinRespawnDelay |
Minimum time before player can respawn after dying.
| int32 AGameMode::NumBots |
number of non-human players (AI controlled but participating as a player).
| int32 AGameMode::NumPlayers |
Current number of human players.
| int32 AGameMode::NumSpectators |
Current number of spectators.
| int32 AGameMode::NumTravellingPlayers |
Number of players that are still traveling from a previous map