Hello,
I have a component that spawns an actor in its BeginPlay method and an actor BP that makes use of that component. This works without trouble when I play a level with the actor BP instance in it. When I open that level from another level via the Open Level BP node I get the following error message:
LogSpawn: Warning: SpawnActor failed because we are running a ConstructionScript (Actor)
The call to SpawnActor returns null. This is the callstack leading to it:
UnrealEditor-UXTools.dll!UUxtBoundsControlComponent::BeginPlay() Line 508 | C++ | |
---|---|---|
UnrealEditor-Engine.dll!UActorComponent::RegisterComponentWithWorld(UWorld * InWorld=0x00000625c38dc800, FRegisterComponentContext * Context=0x0000000000000000) Line 1309 | C++ | |
UnrealEditor-Engine.dll!USimpleConstructionScript::RegisterInstancedComponent(UActorComponent * InstancedComponent=0x00000625b98f4d80) Line 634 | C++ | |
UnrealEditor-Engine.dll!AActor::ExecuteConstruction(const UE::Math::TTransform & Transform={…}, const FRotationConversionCache * TransformRotationCache=0x0000000e1657b840, const FComponentInstanceDataCache * InstanceDataCache=0x00000625b9873b98, bool bIsDefaultTransform=false) Line 792 | C++ | |
> | UnrealEditor-Engine.dll!AActor::RerunConstructionScripts() Line 535 | C++ |
UnrealEditor-Engine.dll!FActorDeferredScriptManager::ProcessAsyncTasks(bool bLimitExecutionTime) Line 83 | C++ | |
UnrealEditor-Engine.dll!FAssetCompilingManager::ProcessAsyncTasks(bool bLimitExecutionTime) Line 349 | C++ | |
UnrealEditor.exe!FEngineLoop::Tick() Line 5257 | C++ | |
… |
Is it not allowed to spawn actors from a component’s BeginPlay? Otherwise, is this a UE bug? I’m using UE 5.0.2. Any help would be much appreciated. Thanks!
Cheers,
Luis