animations doesn’t work after packaging project

Hello , i packaged the project but the animation doesnt work ? i have just few warning


PS:It’s c++ project not just blueprint

Continuing the discussion from animations doesn’t work after packaging project:
i narrow the problem to
First Person animations
UPROPERTY(EditAnywhere, Category = Animation)
UAnimBlueprint* FirstPersonDefaultAnim;
UPROPERTY(EditAnywhere, Category = Animation) UAnimBlueprint* FirstPersonsecondaryweaponAnim;
UPROPERTY(EditAnywhere, Category = Animation)
UAnimBlueprint* FirstPersonfirstweaponAnim;
and apparently when use this GetMesh()->SetAnimInstanceClass(FirstPersonfirstweaponAnim->GeneratedClass); didnt work in shipping but works fine in editor

I got the same issue, turns out the type of FirstPersonDefaultAnim is wrong, it needs to be changed to:

TSubclassOf<UAnimInstance> FirstPersonDefaultAnim;

Then in the cpp, when we call SetAnimInstanceClass, you need to remove →GeneratedClass since the type is now the expected one.

Note that you’ll need to open the editor and edit the BP to set FirstPersonDefaultAnim to the anim, compile and save.

The cooked build should then work and have anims :slight_smile:

PS: note I’ve used TSubclassOf which is a hard ref meaning the anim will load with the character, but the type could be set to TSoftClassPtr but then you’ll have to handle loading it manually