Quick answer: Async Load Class Asset returns UClass. SpawnActor from it. Don’t cast to AActor instance.
Soft class reference for an enemy. AsyncLoadClass completes. You cast to AEnemy and get null. Wrong type — result is the class definition, not an instance.
The Fix
// BP
Async Load Class Asset (SoftClassRef = MyEnemyClass)
→ On Loaded (TSubclassOf<AActor> LoadedClass)
→ Spawn Actor from Class (Class = LoadedClass, Transform = ...)
// C++
UAssetManager::GetStreamableManager().RequestAsyncLoad(
EnemyClass.ToSoftObjectPath(),
FStreamableDelegate::CreateLambda([this] {
auto* Cls = EnemyClass.Get(); // UClass*
GetWorld()->SpawnActor<AActor>(Cls);
})
);
Class then SpawnActor produces an instance. The two-step is intentional — soft references don’t auto-instantiate.
Verifying
Async load + SpawnActor: enemy appears. Direct cast: null. Confirm flow.
“Class then spawn. Two steps.”
Related Issues
For BP Interface defaults, see BPI. For BP Add Unique, see add unique.
Class first. Spawn second.