Quick answer: Project Settings → Packaging → Additional Asset Directories To Cook → add the folder. Or convert to a UPrimaryDataAsset and register a PrimaryAssetType in Asset Manager. The cooker only ships what it knows you’ll need.
Your enemy stat tables are DataAssets in /Game/Data/Enemies. PIE finds and loads them. Shipping build crashes with “Failed to load /Game/Data/Enemies/Goblin.” The cooker dropped them.
The Symptom
Asset works in editor and PIE. Cooked Shipping (or Development) build can’t find the asset at the same path. LoadObject returns null. Crash on dereference.
The Fix Patterns
Pattern 1: AlwaysCook directories. Project Settings → Packaging → Additional Asset Directories To Cook. Add /Game/Data/Enemies (or whatever paths). The cooker includes everything in those directories regardless of references.
Coarse but reliable. Bigger packages.
Pattern 2: Asset Manager + UPrimaryDataAsset.
// EnemyDef.h
UCLASS()
class UEnemyDef : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
virtual FPrimaryAssetId GetPrimaryAssetId() const override
{
return FPrimaryAssetId("EnemyDef", GetFName());
}
UPROPERTY(EditDefaultsOnly) int32 Health;
UPROPERTY(EditDefaultsOnly) FText DisplayName;
};
Project Settings → Asset Manager → Primary Asset Types To Scan:
+ EnemyDef:
Asset Base Class: UEnemyDef
Has Blueprint Classes: false
Is Editor Only: false
Directories: /Game/Data/Enemies
Rules > Cook Rule: Always Cook
Now the cooker scans the directory, registers each asset, and includes them.
Load via UAssetManager::Get().GetPrimaryAssetIdList(...) + LoadPrimaryAsset.
Verifying
Cook for Shipping. Inspect the .pak with UnrealPak --List. Your assets should appear. If not, the directory isn’t covered. Adjust either AlwaysCook directories or Asset Manager rules.
“Tell the cooker. AlwaysCook or PrimaryAsset. Shipping finds them.”
Related Issues
For Blueprint async task pending, see async task. For Niagara mesh attribute, see Niagara mesh.
Cooker sees what you tell it. Tell it.