Gameplay Tag Property Map, how do i set it up?

Inside the Lyra example game’s AnimBP, in the ClassDefaults is a section called ‘Gameplay Tag Property Map’ ( see screenshot ) It seems very useful, but i cant figure out how to set it up.

Does anybody know how this works, and if i can create it myself or is this something created for the Lyra project?

1 Like

Click that + symbol under Property Mappings. That will add another index in the array.
Open it up and there will be two things to fill out!
Let’s focus on the “Edit”
In your project settings there is a section called gameplay tags, open it up and navigate to Event/Movement… here you wanna add your tag like Sprint or whatever you’re adding.
Once you’ve done that you can click that “Edit” button and select that tag.
As for “Property to edit” look under variables in this anim BP and you’ll find the ones starting with “GameplayTag”. I suggest duplicating GameplayTag_isADS and rename it to yours like GameplayTag_Sprint or whatever you’re doing.
Now just select that variable in the “Property to Edit” window and you’re done.
As for what it does:
Generally, what I’ve figured out whenever the gameplay tag changes it will update the variable which you can use in thread-safe operations like in you anim bp. Enjoy!

1 Like

Thanks for the reply, yes i understand all of that but how do i actually add the property map?
It’s not just a variable i can choose ( at least not in BP )

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.

1 Like

Oh wow, thanks for the detailled reply!
Should be able to get this working now, going to keep it for my next project though. Thanks for the efforts!

Just going to add another note here since I found this myself while facing the issue.

ABP_Mannequin_Base in the Lyra project is subclassed from the C++ class LyraGame.LyraAnimInstance and not the standard AnimInstance base class.

If you open up the source directory for the lyra game you will find this file and can copy it to use in your project to achieve the gameplay tag mappings.

2 Likes