Running into this myself and have been working to implement it (warning: this isn’t working for me yet but I feel I’m close). You’ll need C++ to get it going.
This seems to require GAS be setup and configured, at least to the point of having the ability system component created and added to your character. Definitely not gonna go into that here, there’s tutorials on getting it setup elsewhere. I’m not gonna be going much into details on any of this - this assumes you’re pretty comfortable with C++ and can implement GAS without issue.
Then, you need to create your own AnimInstance class and add this code in the header
public:
virtual void InitializeWithAbilitySystem(UAbilitySystemComponent* ASC);
protected:
// Gameplay tags that can be mapped to blueprint variables. The variables will automatically update as the tags are added or removed.
// These should be used instead of manually querying for the gameplay tags.
UPROPERTY(EditDefaultsOnly, Category = "GameplayTags")
FGameplayTagBlueprintPropertyMap GameplayTagPropertyMap;
It can be seen in use in Lyra’s anim instance as well for reference.
Make sure to define InitializeWithAbilitySystem with
check(ASC);
GameplayTagPropertyMap.Initialize(this, ASC);
Then in the editor, re-parent your BP animation blueprint to your newly created C++ class. This will allow you to map properties to tags in the defaults as described by 13tisa13.
Now, that new function “InitializeWithAbilitySystem” needs to be called from your Ability System Component. In your ASC, override “InitAbilityActorInfo” and make sure the definition calls the “InitializeWithAbilitySystem” in your anim instance. This is my code for that (it’s a stripped down version of what’s used in Lyra):
FGameplayAbilityActorInfo* ActorInfo = AbilityActorInfo.Get();
check(ActorInfo);
check(InOwnerActor);
const bool bHasNewPawnAvatar = Cast<APawn>(InAvatarActor) && (InAvatarActor != ActorInfo->AvatarActor);
Super::InitAbilityActorInfo(InOwnerActor, InAvatarActor);
if (bHasNewPawnAvatar)
{
if (UMyAnimInstance* MyAnimInstance = Cast<UMyAnimInstance>(ActorInfo->GetAnimInstance()))
{
MyAnimInstance->InitializeWithAbilitySystem(this);
}
}
I have added debuggers in and ensured that everything is being called. I imagine “GameplayTagPropertyMap.Initialize(this, ASC);” is the critical piece of code that ties it all together. I can map properties to GameplayTags in my anim blueprint but so far it doesn’t seem to actually be doing anything. So I must be missing another piece that connects all of this.
Edit: Ok, so the above WILL make it work and I think that’s all you need. But I wasn’t understanding the way the mapping worked. The idea is simply that you can set a GameplayTag somewhere and then map it to a variable and then when you access the variable in your anim blueprint, it will match the tag. I was trying to SET flags using this which you can’t do … and after further thought, that makes sense.