This is odd.
I’m Spawning an Actor using UGameplayStatics::BeginDeferredActorSpawnFromClass(). I’ve set this up so that it fails if there is any collision on the spawned actor.
Spawning ultimately fails, because there is encroaching geometry (which is what I want) - but the GameplayStatics function still returns a pointer to a valid new actor? How is that possible?
I checked the log, and the following line is printed:
SpawnActor failed because of collision at the spawn location [%s] for [%s]
When checking the Source Code, this appears in LevelActor.cpp - line 419:
if (EncroachingBlockingGeometry(Template, FinalRootLocation, FinalRootRotation))
{
// a native component is colliding, that's enough to reject spawning
UE_LOG(LogSpawn, Log, TEXT("SpawnActor failed because of collision at the spawn location [%s] for [%s]"), *FinalRootLocation.ToString(), *Class->GetName());
return nullptr;
}
As you can see, the Spawn SHOULD be returning nullptr as soon as it prints this message, but it doesn’t! How am I supposed to check whether my actor was properly spawned or not?