AActor::IsActorBeginningPlayFromLevelStreaming
#include "GameFramework/Actor.h"
Access: public
Specifiers: inline
Description
Returns true when BeginPlay is being dispatched as a result of level streaming (including initial level load). Only valid during the BeginPlay window; false at all other times.
Caveats & Gotchas
- • This flag is set by DispatchBeginPlay() and cleared immediately after, so it is only meaningful to query from within BeginPlay or a function called transitively from it.
- • Actors spawned dynamically at runtime (e.g. via SpawnActor) will always return false here because they are not part of a streaming-triggered begin-play pass.
Signature
bool IsActorBeginningPlayFromLevelStreaming() const { return bActorBeginningPlayFromLevelStreaming; } Return Type
bool Example
Distinguish streaming load from runtime spawn inside BeginPlay C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
if (IsActorBeginningPlayFromLevelStreaming())
{
// Loaded with the level — skip expensive one-time spawn setup
}
else
{
// Dynamically spawned — run full initialization
PerformSpawnSetup();
}
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?