RealDocs

AGameModeBase::HandleStartingNewPlayer

function Engine Blueprint Since 4.14
#include "GameFramework/GameModeBase.h"
Access: public Specifiers: UFUNCTIONBlueprintNativeEvent

Description

Called at the end of `PostLogin` to signal that the player is ready to enter the game. The default implementation calls `RestartPlayer` unless `bStartPlayersAsSpectators` is set.

Caveats & Gotchas

  • This is where pawns are actually spawned during login. If you override this without calling `Super`, no pawn will be spawned unless you call `RestartPlayer` manually.
  • Because this is a `BlueprintNativeEvent`, the C++ override must be named `HandleStartingNewPlayer_Implementation`. The Blueprint-callable version (without the suffix) dispatches to the implementation automatically.
  • If `bStartPlayersAsSpectators` is true, the base implementation does nothing — you must call `RestartPlayer` yourself when you want the player to enter the game.

Signature

ENGINE_API void HandleStartingNewPlayer(APlayerController* NewPlayer)

Parameters

Name Type Description Default
NewPlayer APlayerController* The player controller that is ready to enter the game.

Return Type

void

Example

Delay spawning until the player chooses a team C++
void AMyGameMode::HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer)
{
    // Don't spawn yet — wait for the player to pick a team
    if (AMyPlayerState* PS = NewPlayer->GetPlayerState<AMyPlayerState>())
    {
        if (!PS->bHasChosenTeam)
        {
            // Show team selection UI; RestartPlayer called later
            NewPlayer->ClientShowTeamSelectionUI();
            return;
        }
    }

    Super::HandleStartingNewPlayer_Implementation(NewPlayer);
}

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.