RealDocs

AGameModeBase::StartPlay

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

Description

Triggers the transition from initialization to gameplay by calling BeginPlay on all actors. Override to add pre-game setup that must complete before actors receive BeginPlay.

Caveats & Gotchas

  • This is what actually fires Actor::BeginPlay across the world. If you override it without calling Super::StartPlay(), no actors will receive BeginPlay and the game will appear frozen.
  • In AGameMode (the subclass), this drives match-state changes. In AGameModeBase, it simply calls WorldSettings->NotifyBeginPlay() and then WorldSettings->NotifyMatchStarted().

Signature

UFUNCTION(BlueprintCallable, Category=Game)
virtual void StartPlay()

Return Type

void

Examples

Override StartPlay to spawn actors before BeginPlay fires Blueprint
Event Start Play Spawn Actor From Class Class BP_MyPickup Spawn Transform Return Value Parent: Start Play Make Transform Location (0.0, 0.0, 100.0) (0.0, 0.0, 100.0) Rotation (0.0, 0.0, 0.0) (0.0, 0.0, 0.0) Scale (1.0, 1.0, 1.0) (1.0, 1.0, 1.0) Return Value
Edit Blueprint graph Override StartPlay to spawn actors before BeginPlay fires
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Override to run logic before BeginPlay fires C++
void AMyGameMode::StartPlay()
{
    // Spawn initial pickups before any actor receives BeginPlay
    SpawnInitialPickups();
    Super::StartPlay(); // fires BeginPlay on all actors
}

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.