Class GameModeBase
The GameModeBase defines the game being played.
Inheritance
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class GameModeBase : Info
Remarks
It governs the game rules, scoring, what actors are allowed to exist in this game type, and who may enter the game.
It is only instanced on the server and will never exist on the client.
A GameModeBase actor is instantiated when the level is initialized for gameplay in C++ UGameEngine::LoadMap().
The class of this GameMode actor is determined by (in order) either the URL ?game=xxx, the GameMode Override value set in the World Settings, or the DefaultGameMode entry set in the game's Project Settings.
@see https://docs.unrealengine.com/latest/INT/Gameplay/Framework/GameMode/index.html
Properties
| Improve this Doc View SourcebPauseable
Declaration
public bool bPauseable { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bStartPlayersAsSpectators
Declaration
public bool bStartPlayersAsSpectators { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bUseSeamlessTravel
Declaration
public bool bUseSeamlessTravel { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static GameModeBase DefaultObject { get; }
Property Value
| Type | Description |
|---|---|
| GameModeBase |
DefaultPawnClass
The default pawn class used by players.
Declaration
public SubclassOf<Pawn> DefaultPawnClass { get; set; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<Pawn> |
GameSession
Game Session handles login approval, arbitration, online game interface
Declaration
public GameSession GameSession { get; set; }
Property Value
| Type | Description |
|---|---|
| GameSession |
GameSessionClass
Class of GameSession, which handles login approval and online game interface
Declaration
public SubclassOf<GameSession> GameSessionClass { get; set; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<GameSession> |
GameState
GameState is used to replicate game state relevant properties to all clients.
Declaration
public GameStateBase GameState { get; set; }
Property Value
| Type | Description |
|---|---|
| GameStateBase |
GameStateClass
Class of GameState associated with this GameMode.
Declaration
public SubclassOf<GameStateBase> GameStateClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<GameStateBase> |
HUDClass
HUD class this game uses.
Declaration
public SubclassOf<HUD> HUDClass { get; set; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<HUD> |
PlayerControllerClass
The class of PlayerController to spawn for players logging in.
Declaration
public SubclassOf<PlayerController> PlayerControllerClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<PlayerController> |
PlayerStateClass
A PlayerState of this class will be associated with every player to replicate relevant player information to all clients.
Declaration
public SubclassOf<PlayerState> PlayerStateClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<PlayerState> |
ReplaySpectatorPlayerControllerClass
The PlayerController class used when spectating a network replay.
Declaration
public SubclassOf<PlayerController> ReplaySpectatorPlayerControllerClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<PlayerController> |
ServerStatReplicator
Server Stat Replicator
Declaration
public ServerStatReplicator ServerStatReplicator { get; set; }
Property Value
| Type | Description |
|---|---|
| ServerStatReplicator |
ServerStatReplicatorClass
Server Stat Replicator Class
Declaration
public SubclassOf<ServerStatReplicator> ServerStatReplicatorClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<ServerStatReplicator> |
SpectatorClass
The pawn class used by the PlayerController for players when spectating.
Declaration
public SubclassOf<SpectatorPawn> SpectatorClass { get; }
Property Value
| Type | Description |
|---|---|
| SubclassOf<SpectatorPawn> |
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
| Type | Description |
|---|---|
| Class |
Methods
| Improve this Doc View SourceChangeName(Controller, String, Boolean)
Sets the name for a controller @
Declaration
public void ChangeName(Controller Controller, string NewName, bool bNameChange)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller | Controller | |
| System.String | NewName | |
| System.Boolean | bNameChange |
Remarks
param Controller The controller of the player to change the name of @param NewName The name to set the player to @param bNameChange Whether the name is changing or if this is the first time it has been set
GetNumPlayers()
Returns number of active human players, excluding spectators
Declaration
public int GetNumPlayers()
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetNumSpectators()
Returns number of human players currently spectating
Declaration
public int GetNumSpectators()
Returns
| Type | Description |
|---|---|
| System.Int32 |
HasMatchStarted()
Returns true if the match start callbacks have been called
Declaration
public bool HasMatchStarted()
Returns
| Type | Description |
|---|---|
| System.Boolean |
K2_FindPlayerStart(Controller, String)
Return the specific player start actor that should be used for the next spawn This will either use a previously saved startactor, or calls ChoosePlayerStart @
Declaration
public Actor K2_FindPlayerStart(Controller Player, string IncomingName)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller | Player | |
| System.String | IncomingName |
Returns
| Type | Description |
|---|---|
| Actor |
Remarks
param Player The AController for whom we are choosing a Player Start @param IncomingName Specifies the tag of a Player Start to use @returns Actor chosen as player start (usually a PlayerStart)
New(UObject, Name)
Spawn an object of this class
Declaration
public static GameModeBase New(UObject obj = null, Name name = default(Name))
Parameters
| Type | Name | Description |
|---|---|---|
| UObject | obj | |
| Name | name |
Returns
| Type | Description |
|---|---|
| GameModeBase |
ResetLevel()
Overridable function called when resetting level.
Declaration
public void ResetLevel()
Remarks
This is used to reset the game state while staying in the same map Default implementation calls Reset() on all actors except GameMode and Controllers
RestartPlayer(Controller)
Tries to spawn the player's pawn, at the location returned by FindPlayerStart
Declaration
public void RestartPlayer(Controller NewPlayer)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller | NewPlayer |
RestartPlayerAtPlayerStart(Controller, Actor)
Tries to spawn the player's pawn at the specified actor's location
Declaration
public void RestartPlayerAtPlayerStart(Controller NewPlayer, Actor StartSpot)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller | NewPlayer | |
| Actor | StartSpot |
RestartPlayerAtTransform(Controller, Transform)
Tries to spawn the player's pawn at a specific location
Declaration
public void RestartPlayerAtTransform(Controller NewPlayer, Transform SpawnTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller | NewPlayer | |
| Transform | SpawnTransform |
ReturnToMainMenuHost()
Return to main menu, and disconnect any players
Declaration
public void ReturnToMainMenuHost()
StartPlay()
Transitions to calls BeginPlay on actors.
Declaration
public void StartPlay()
Events
| Improve this Doc View SourceCanSpectate
Return whether Viewer is allowed to spectate from the point of view of ViewTarget.
Declaration
public event GameModeBase.CanSpectate_delegate CanSpectate
Event Type
| Type | Description |
|---|---|
| GameModeBase.CanSpectate_delegate |
ChoosePlayerStart
Return the 'best' player start for this player to spawn from Default implementation looks for a random unoccupied spot @
Declaration
public event GameModeBase.ChoosePlayerStart_delegate ChoosePlayerStart
Event Type
| Type | Description |
|---|---|
| GameModeBase.ChoosePlayerStart_delegate |
Remarks
param Player is the controller for whom we are choosing a playerstart @returns AActor chosen as player start (usually a PlayerStart)
FindPlayerStart
Return the specific player start actor that should be used for the next spawn This will either use a previously saved startactor, or calls ChoosePlayerStart @
Declaration
public event GameModeBase.FindPlayerStart_delegate FindPlayerStart
Event Type
| Type | Description |
|---|---|
| GameModeBase.FindPlayerStart_delegate |
Remarks
param Player The AController for whom we are choosing a Player Start @param IncomingName Specifies the tag of a Player Start to use @returns Actor chosen as player start (usually a PlayerStart)
GetDefaultPawnClassForController
Returns default pawn class for given controller
Declaration
public event GameModeBase.GetDefaultPawnClassForController_delegate GetDefaultPawnClassForController
Event Type
| Type | Description |
|---|---|
| GameModeBase.GetDefaultPawnClassForController_delegate |
HandleStartingNewPlayer
Signals that a player is ready to enter the game, which may start it up
Declaration
public event GameModeBase.HandleStartingNewPlayer_delegate HandleStartingNewPlayer
Event Type
| Type | Description |
|---|---|
| GameModeBase.HandleStartingNewPlayer_delegate |
InitializeHUDForPlayer
Initialize the AHUD object for a player. Games can override this to do something different
Declaration
public event GameModeBase.InitializeHUDForPlayer_delegate InitializeHUDForPlayer
Event Type
| Type | Description |
|---|---|
| GameModeBase.InitializeHUDForPlayer_delegate |
InitStartSpot
Called from RestartPlayerAtPlayerStart, can be used to initialize the start spawn actor
Declaration
public event GameModeBase.InitStartSpot_delegate InitStartSpot
Event Type
| Type | Description |
|---|---|
| GameModeBase.InitStartSpot_delegate |
K2_OnChangeName
Overridable event for GameMode blueprint to respond to a change name call @
Declaration
public event GameModeBase.K2_OnChangeName_delegate K2_OnChangeName
Event Type
| Type | Description |
|---|---|
| GameModeBase.K2_OnChangeName_delegate |
Remarks
param Controller The controller of the player to change the name of @param NewName The name to set the player to @param bNameChange Whether the name is changing or if this is the first time it has been set
K2_OnLogout
Implementable event when a Controller with a PlayerState leaves the game.
Declaration
public event GameModeBase.K2_OnLogout_delegate K2_OnLogout
Event Type
| Type | Description |
|---|---|
| GameModeBase.K2_OnLogout_delegate |
K2_OnRestartPlayer
Implementable event called at the end of RestartPlayer
Declaration
public event GameModeBase.K2_OnRestartPlayer_delegate K2_OnRestartPlayer
Event Type
| Type | Description |
|---|---|
| GameModeBase.K2_OnRestartPlayer_delegate |
K2_OnSwapPlayerControllers
Called when a PlayerController is swapped to a new one during seamless travel
Declaration
public event GameModeBase.K2_OnSwapPlayerControllers_delegate K2_OnSwapPlayerControllers
Event Type
| Type | Description |
|---|---|
| GameModeBase.K2_OnSwapPlayerControllers_delegate |
K2_PostLogin
Notification that a player has successfully logged in, and has been given a player controller
Declaration
public event GameModeBase.K2_PostLogin_delegate K2_PostLogin
Event Type
| Type | Description |
|---|---|
| GameModeBase.K2_PostLogin_delegate |
MustSpectate
Returns true if NewPlayerController may only join the server as a spectator.
Declaration
public event GameModeBase.MustSpectate_delegate MustSpectate
Event Type
| Type | Description |
|---|---|
| GameModeBase.MustSpectate_delegate |
PlayerCanRestart
Returns true if it's valid to call RestartPlayer. By default will call Player->CanRestartPlayer
Declaration
public event GameModeBase.PlayerCanRestart_delegate PlayerCanRestart
Event Type
| Type | Description |
|---|---|
| GameModeBase.PlayerCanRestart_delegate |
ShouldReset
Overridable function to determine whether an Actor should have Reset called when the game has Reset called on it.
Declaration
public event GameModeBase.ShouldReset_delegate ShouldReset
Event Type
| Type | Description |
|---|---|
| GameModeBase.ShouldReset_delegate |
Remarks
Default implementation returns true @param ActorToReset The actor to make a determination for @return true if ActorToReset should have Reset() called on it while restarting the game, false if the GameMode will manually reset it or if the actor does not need to be reset
SpawnDefaultPawnFor
Called during RestartPlayer to actually spawn the player's pawn, when using a start spot @
Declaration
public event GameModeBase.SpawnDefaultPawnFor_delegate SpawnDefaultPawnFor
Event Type
| Type | Description |
|---|---|
| GameModeBase.SpawnDefaultPawnFor_delegate |
Remarks
param NewPlayer - Controller for whom this pawn is spawned @param StartSpot - Actor at which to spawn pawn @return a pawn of the default pawn class
Operators
| Improve this Doc View SourceImplicit(IntPtr to GameModeBase)
Convert from IntPtr to UObject
Declaration
public static implicit operator GameModeBase(IntPtr p)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | p |
Returns
| Type | Description |
|---|---|
| GameModeBase |