RealDocs

APawn::BeginPlay

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Called when the game starts or when the pawn is spawned into the world. APawn's implementation broadcasts the static OnPawnBeginPlay delegate and handles auto-possession for player and AI controllers.

Caveats & Gotchas

  • Always call Super::BeginPlay() first in your override. APawn's BeginPlay handles auto-possession setup — skipping it means AutoPossessPlayer and AutoPossessAI will not trigger correctly.
  • At the time BeginPlay is called, the Controller may still be nullptr even if AutoPossessPlayer is set — possession happens asynchronously after BeginPlay during startup. Do not assume possession is complete inside BeginPlay.

Signature

virtual void BeginPlay() override;

Return Type

void

Example

Basic APawn BeginPlay override C++
void AMyPawn::BeginPlay()
{
	Super::BeginPlay(); // Must come first
	// At this point components are initialized and the world is ready
	InitializeAbilitySystem();
	SpawnStartingEquipment();
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.