UGameplayStatics::FinishSpawningActor
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Completes a deferred actor spawn started by BeginDeferredActorSpawnFromClass, running the construction script and calling BeginPlay. Returns the now-fully-initialized actor.
Caveats & Gotchas
- • If Actor is null (e.g., the begin-spawn was rejected by collision), FinishSpawningActor is a no-op and returns null — it does not crash, but callers relying on the return value must still null-check.
- • The SpawnTransform you pass here is what the construction script sees; it does not have to match the transform passed to BeginDeferredActorSpawnFromClass, giving you a window to compute a corrected position between the two calls.
- • UnsafeDuringActorConstruction: same restriction as the Begin counterpart — never call inside a constructor or construction script.
Signature
static ENGINE_API class AActor* FinishSpawningActor(class AActor* Actor, const FTransform& SpawnTransform, ESpawnActorScaleMethod TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Actor | class AActor* | The actor returned from BeginDeferredActorSpawnFromClass. | — |
| SpawnTransform | const FTransform& | Final world transform applied during construction script execution. | — |
| TransformScaleMethod | ESpawnActorScaleMethod | How the spawn transform scale is combined with the actor's root component scale. | ESpawnActorScaleMethod::MultiplyWithRoot |
Return Type
AActor* Example
Complete a deferred spawn C++
AMyActor* Actor = Cast<AMyActor>(
UGameplayStatics::BeginDeferredActorSpawnFromClass(
this, AMyActor::StaticClass(), InitialTransform));
if (Actor)
{
Actor->CustomData = MyData; // set before construction script
UGameplayStatics::FinishSpawningActor(Actor, InitialTransform);
// Actor is now fully live
} See Also
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?