UGameplayStatics::BeginSpawningActorFromBlueprint
Deprecated: Use BeginSpawningActorFromClass (BeginDeferredActorSpawnFromClass).
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Deprecated. Spawns an actor from a Blueprint asset without running its construction script, allowing deferred initialization before FinishSpawningActor is called.
Caveats & Gotchas
- • Officially deprecated — the DeprecationMessage in the header directs callers to BeginDeferredActorSpawnFromClass, which takes a TSubclassOf<AActor> instead of a UBlueprint reference.
- • UnsafeDuringActorConstruction: calling this inside a constructor or construction script is not supported and will assert in Debug/Development builds.
- • The actor's construction script is not run until FinishSpawningActor is called; any BP-construction-time initialization (e.g. component setup) is deferred until then.
Signature
static ENGINE_API class AActor* BeginSpawningActorFromBlueprint(const UObject* WorldContextObject, const class UBlueprint* Blueprint, const FTransform& SpawnTransform, bool bNoCollisionFail); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to retrieve the world context. | — |
| Blueprint | const class UBlueprint* | The Blueprint asset whose generated class will be spawned. | — |
| SpawnTransform | const FTransform& | Initial world transform for the spawned actor. | — |
| bNoCollisionFail | bool | If true, spawn even when the location overlaps existing geometry. | — |
Return Type
AActor* Example
Migrated usage (prefer BeginDeferredActorSpawnFromClass) C++
// Old (deprecated):
// AActor* Actor = UGameplayStatics::BeginSpawningActorFromBlueprint(this, MyBP, Transform, true);
// New (preferred):
AActor* Actor = UGameplayStatics::BeginDeferredActorSpawnFromClass(
this,
AMyActor::StaticClass(),
Transform,
ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
if (Actor)
{
// Set properties before construction script runs
UGameplayStatics::FinishSpawningActor(Actor, Transform);
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | deprecated | Deprecated in favor of BeginDeferredActorSpawnFromClass. |
Feedback
Was this helpful?