Animation Blueprint code with different skeletons

I found a relatively easy way around overriding animations from within the base animation blueprint.

You’ll need to create a derived UDataAsset class to contain all your animation references. This example code just contains a single reference to an idle animation for example purposes.



UCLASS()

**class** WBSAMPLE_API UAnimationPayloadAsset : **public** UDataAsset
{
GENERATED_BODY()

**public**:

    UPROPERTY(Category = "BaseIdle", EditAnywhere, BlueprintReadWrite)
    UAnimSequence* BaseIdle;
}


Then from inside the AnimGraph extract the referenced animation :


https://forums.unrealengine.com/core/image/gif;base64

From here :

  1. Create one AnimationPayloadAsset per unique Skeleton.
  2. In the base Animation Blueprint Event Graph, set a variable (coming from your pawn) that references an Animation Payload Asset.
  3. Inside the AnimGraph logic, set the Animation Sequence to play from the corresponding animation within the Animation Payload.

My example above has a CharacterPayload (CharacterPayloadAsset) which contains a reference to a specific AnimationPayload (AnimationPayloadAsset) asset.

For those of you who don’t code or have a coder to help create the above class, it might be easier for you to use a Blueprint Structure that contains references to all your animations. Then create a data table from this structure in which each row represents a unique skeleton in your project.