RealDocs

AActor::BeginPlay

function Engine Blueprint Since 1.0
#include "GameFramework/Actor.h"
Access: protected Specifiers: virtual

Description

Called when the actor is fully initialized and play begins in the world. This is called after all components have been registered and initialized. Use BeginPlay for any runtime setup that requires the actor to be fully in the world.

Caveats & Gotchas

  • Always call `Super::BeginPlay()` as the first line when overriding, to ensure base class and component initialization runs.
  • BeginPlay is called after the constructor and after `PostInitializeComponents()`. The actor is fully registered at this point.
  • For components, the component's `BeginPlay()` is called after the owning actor's `BeginPlay()`.
  • In multiplayer, BeginPlay is called on all instances (server and clients). Use `HasAuthority()` to gate server-only logic.

Signature

virtual void BeginPlay()

Return Type

void

Examples

Branch on authority in BeginPlay to gate server-only initialization Blueprint
Event BeginPlay Branch Condition Condition True False Print String In String BeginPlay on Server! BeginPlay on Server! Has Authority Target is Actor Return Value Return Value
Edit Blueprint graph Branch on authority in BeginPlay to gate server-only initialization
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Overriding BeginPlay C++
void AMyActor::BeginPlay()
{
    Super::BeginPlay(); // Always call Super first!

    // Safe to query world, other actors, or components here
    UE_LOG(LogTemp, Log, TEXT("%s has begun play"), *GetName());

    if (HasAuthority())
    {
        // Server-only initialization
        InitServerState();
    }
}

Version History

Introduced in: 1.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.