The AnimMontage has a “Meta Data” that I can associate with it to add more information to that montage. The documentation on: Animation Montage | Unreal Engine Documentation – explains how to later query that Meta Data on c++.
But what about Blueprints? I was able to create a Meta Data class, associate it to my AnimMontage. But now how can I get this Meta Data from an anim graph? I can get a reference to my Montage in the graph, but there’s nothing about Meta Data in it.
If you are searching for MetaData in AnimMontage is probably because you want to pass data to the AnimMontage from your code. The way to do it is not to use MetaData, but to create a subclass of UAnimNotify, which holds the parameter and then pass this parameter to it from your code.
Yes, create a blueprint function library in C++ and add this function to the header:
/** Retrieves all Meta Data Instances from the given Animation Sequence */
UFUNCTION(BlueprintPure, Category = "Animation")
static void GetMetaData(const UAnimSequenceBase* AnimationSequence, TArray<UAnimMetaData*>& MetaData);
void UMyBlueprintFunctionLibrary::GetMetaData(const UAnimSequenceBase* AnimationSequence, TArray<UAnimMetaData*>& MetaData)
MetaData = AnimationSequence->GetMetaData();
cast node to cast the AnimMetaData object to your specific MetaData class.