Animation Blueprint load failed in packaged build

Hello.
Please, help with the next situation (UE 5.2): I load skeletal mesh & animation blueprint in C++ by soft pointers. Everything is ok in the Editor, but animation blueprint load failed in packaged build (skeletal mesh load is ok everywhere).

// take struct from datatable
FLegsData* LegsData = LegsRow.DataTable->FindRow<FLegsData>(LegsRow.RowName, "", false);

TArray<FSoftObjectPath> SoftPaths;
TSoftObjectPtr<USkeletalMesh> LegsSkelMesh;
TSoftObjectPtr<UAnimBlueprint> LegsAnimBp;

if (!LegsData->SkelMesh.IsNull())
{
	LegsSkelMesh = LegsData->SkelMesh;
	SoftPaths.Add(LegsData->SkelMesh.ToSoftObjectPath());

	if (!LegsData->AnimBp.IsNull())
	{
		LegsAnimBp = LegsData->AnimBp;
		SoftPaths.Add(LegsData->AnimBp.ToSoftObjectPath());
	}
}

if (!SoftPaths.IsEmpty())
{
	TSharedPtr<FStreamableHandle> Handle = UAssetManager::Get().GetStreamableManager()
	.RequestAsyncLoad(SoftPaths, [this, LegsSkelMesh, LegsAnimBp]()
    {
        // its ok in editor and packaged build
		if (!LegsSkelMesh.IsNull())
			GetMesh()->SetSkeletalMeshAsset(LegsSkelMesh.Get());

		if (!LegsAnimBp.IsNull()) // ok
		{
			if (LegsAnimBp.Get()) // <--- false in packaged build!
			{
				if (LegsAnimBp.Get()->GetAnimBlueprintGeneratedClass())
				{				GetMesh()->SetAnimInstanceClass(LegsAnimBp.Get()->GetAnimBlueprintGeneratedClass());
				}
			}
		}					
	});
}

Maybe there is another ‘true-way’ to async load soft-ptr assets? All I need is async load and use soft-ptr skeletal mesh and after that async load and apply soft-ptr anim-bp for this skeletal mesh.

Can you share a shot of the data you are using?

struct FLegsData

USTRUCT(BlueprintType)
struct FLegsData : public FTableRowBase
{
	GENERATED_USTRUCT_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSoftObjectPtr<USkeletalMesh> SkelMesh;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSoftObjectPtr<UAnimBlueprint> AnimBp;

	FLegsData() {};
}

In editor I created a datatable based on that struct and filled it with ‘Skeletal Mesh’ and ‘Animation Blueprint’ assets.
The animation blueprint is just a generic animation blueprint, created in editor.

I assume the AnimBP was created from the same SkeletalMesh?

Yep, sure :slight_smile:
In editor (PIE, Standalone) everything is ok, but in packaged build anim-bp isn’t loaded: nullptr on .Get()
build command line:

BuildCookRun -noP4 -platform=Win64 -clientconfig=Development -serverconfig=Development -cook -allmaps -build -stage -pak -archive

I think fixed it by switching from
TSoftObjectPtr<UAnimBlueprint>
to
TSoftClassPtr<UAnimInstance>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.