Quick answer: Soft class pointers do not force the Blueprint to be cooked. If no hard reference exists, the cook excludes it and runtime loads return null. Register the class type with Asset Manager (set Has Blueprint Classes = true), or add the directory to Additional Asset Directories To Cook.

Here is how to fix Unreal TSoftClassPtr<UMyClass> loads that succeed in PIE but return null in packaged builds. Soft references are designed to allow on-demand loading without ballooning the cook size, but they require explicit Asset Manager registration to ensure the targets ship at all. Without it, your enemy classes, weapon archetypes, or whatever you store as soft refs simply are not in the build.

The Symptom

A TSoftClassPtr field references a Blueprint class. PIE works fine. Packaged build fails to spawn the class — SpawnActor with the loaded UClass returns null, or LoadSynchronous on the soft pointer returns null.

What Causes This

Soft class refs do not create cook dependencies. Same as soft object refs. The cooker only includes assets that are reachable through hard references or registered in Asset Manager.

No Asset Manager entry. Without registering the class type, the cook does not know to scan a directory for matching Blueprint classes.

Has Blueprint Classes flag off. When configuring an Asset Manager primary type, this flag must be true for Blueprint subclasses to be discovered (vs DataAssets which are not classes).

Class compiled but not in any redirector chain. Renaming a Blueprint can break soft refs if redirectors are missing. Open the Asset Audit window to find broken references.

The Fix

Step 1: Register the class in Asset Manager. Open Project Settings → Asset Manager → Primary Asset Types To Scan:

Primary Asset Type:    Enemy
Asset Base Class:      AEnemyBase
Has Blueprint Classes: true
Directories:           [/Game/Enemies]
Cook Rule:             AlwaysCook

This makes the cooker include every Blueprint subclass of AEnemyBase under /Game/Enemies, even if no scene hard-references them.

Step 2: Async load via FStreamableManager.

void USpawnSubsystem::SpawnEnemy(TSoftClassPtr<AEnemyBase> enemyClass, FVector loc)
{
    UAssetManager& AM = UAssetManager::Get();
    FStreamableManager& SM = AM.GetStreamableManager();

    SM.RequestAsyncLoad(enemyClass.ToSoftObjectPath(),
        FStreamableDelegate::CreateLambda([enemyClass, loc, this]()
        {
            UClass* loaded = enemyClass.Get();
            if (loaded)
            {
                GetWorld()->SpawnActor(loaded, &loc);
            }
            else
            {
                UE_LOG(LogTemp, Warning, TEXT("Class not loaded: %s"),
                       *enemyClass.ToString());
            }
        }));
}

Step 3: Verify in the cooked build. After packaging, list the .pak contents:

UnrealPak.exe MyGame-Pak.pak -List | grep Goblin

If your Blueprint does not appear, Asset Manager registration is wrong or the directory does not match.

Step 4: Add fallback handling. If a soft class fails to load (corrupted asset, missing redirector), fail gracefully:

if (UClass* C = enemyClass.Get())
{
    GetWorld()->SpawnActor<AActor>(C, loc, FRotator::ZeroRotator);
}
else
{
    // substitute a default fallback class shipped hard-referenced
    GetWorld()->SpawnActor<AActor>(DefaultEnemyClass, loc, FRotator::ZeroRotator);
}

Step 5: Use TAssetSubclassOf or alias if migrating. Older code uses TAssetSubclassOf; modern UE uses TSoftClassPtr. They are equivalent for cook semantics. Update old code for clarity.

Hard vs Soft Class

Hard class references (TSubclassOf<AEnemyBase>) force the class to be cooked. Use them for archetypes always loaded with the level. Soft class references are for on-demand: large variety of enemies, modular DLC content, runtime-selected variants.

“Soft refs ship on demand only. Asset Manager fills the gap. Without it, the cook leaves your classes behind.”

Related Issues

For data asset soft refs, see Data Asset Soft Ref Null. For multicast RPC issues, see Multicast RPC.

Has Blueprint Classes = true. Directory listed. Cook rule AlwaysCook. The class survives the cook.