I have a strange issue. Basically:
I spawn actor of class A. (Actor pre-placed in level)
I spawn ~20 instances of actor of class B (class B is largely unrelated to class A. Spawned via UWorld:SpawnActorAbsolute)
I delete instance of class A
I spawn instance of class A (Spawned via UWorld:SpawnActorAbsolute)
I spawn instance of class B (Spawned via UWorld:SpawnActorAbsolute)
On this last spawn, the actor of class B’s root component is spawning already IsPendingKill. (Output says “Trying to register component with IsPendingKill() == true. Aborting.” Callstack is:
UE4Editor-Engine.dll!UActorComponent::RegisterComponentWithWorld(UWorld * InWorld) Line 958 C++
UE4Editor-Engine.dll!AActor::IncrementalRegisterComponents(int NumComponentsToRegister) Line 4004 C++
UE4Editor-Engine.dll!AActor::RegisterAllComponents() Line 3940 C++
UE4Editor-Engine.dll!AActor::PostSpawnInitialize(const FTransform & UserSpawnTransform, AActor * InOwner, APawn * InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction) Line 2728 C++
UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FTransform * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 438 C++
UE4Editor-Engine.dll!UWorld::SpawnActorAbsolute(UClass * Class, const FTransform & AbsoluteTransform, const FActorSpawnParameters & SpawnParameters) Line 256 C++
All other components are OK, but the actor spawns with a messed up component hierarchy due to being missing its root.
Does anyone know of any circumstances which would cause a component to spawn IsPendingKill? This problem is being a real headache to debug due to IsPendingKill living in the global GUObjectArray a few thousand entries in, and IsPendingKill being just one flag in a bitwise array which the debugger doesn’t really know how to parse.
I know actors will spawn IsPendingKill if they spawn into collision, but this is just the one component. The component in question is a USceneComponent, so it doesn’t even have collision, and there shouldn’t be anything special going on with it. And dozens of instances of it spawned just prior without problem. It seems like my spawning of the other, unrelated actor is somehow messing it up, but I don’t even know in principle how that might be happening. This is part of some save/load work, so there are some UObjects being serialized, but all I’m saving are UProperties, and only some specific ones at that, so that shouldn’t be affecting the component’s IsPendingKillFlag.
I really just need some ideas for avenues of investigation, here. Anyone have any ideas for what could possibly be causing this?