AActor::DispatchBeginPlay
#include "GameFramework/Actor.h"
Access: public
Specifiers: ENGINE_API
Description
Engine-internal function that orchestrates the full BeginPlay call chain in the correct order — initializing components, calling PreInitializeComponents, PostInitializeComponents, then BeginPlay on the actor and all its components.
Caveats & Gotchas
- • Do not call this directly from game code. It is invoked by the engine at the correct point in the actor lifecycle. Calling it manually can cause double-initialization and assert failures.
- • The bFromLevelStreaming parameter affects bActorBeginningPlayFromLevelStreaming, which is used internally but also queryable via IsActorBeginningPlayFromLevelStreaming() inside BeginPlay overrides if you need to distinguish level-load spawns from runtime spawns.
Signature
ENGINE_API void DispatchBeginPlay(bool bFromLevelStreaming = false); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bFromLevelStreaming | bool | Whether this BeginPlay call originates from level streaming (including initial level load). Readable via IsActorBeginningPlayFromLevelStreaming(). | false |
Return Type
void Example
Checking level streaming origin inside BeginPlay C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
// DispatchBeginPlay sets the streaming flag before calling here
if (IsActorBeginningPlayFromLevelStreaming())
{
// Distinguish initial load from runtime spawn
UE_LOG(LogTemp, Log, TEXT("Spawned during level load/stream"));
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?