Storing state in Gameplay Tags makes it easier to store state and create interesting gameplay. At the same time it lets you create data inside the editor without the need to write extra lines of code.
Unfortunately, not many Unreal Engine developers are aware that they exist or their usefulness and end up writing unneeded code.
I keep my tag guides together in the Gameplay Tags hub, and if you are new to GAS itself, start with Introduction to GAS: The Six Pieces of Unreal’s Gameplay Ability System.
What Are Gameplay Tags in Unreal Engine?
Gameplay tags are “names” that can be added to actors to represent multiple things.
Ex: Character, Enemy, Interactable, Locked
They have a hierarchical form so you can group them to represent complex data, this is done using a dot between names.
Ex: StatusEffect.Burn, StatusEffect.Poison, Character, Character.NPC, Character.NPC.Enemy
Implement IGameplayTagAssetInterface
To use gameplay tags we require that an actor implements the IGameplayTagAssetInterface and implement the four functions that come with it. We then can store the tags into a FGameplayTagContainer or a more complex structure like the UAbilitySystemComponent if we are using Unreal GAS ( Gameplay Ability System ).
The functions that we must implement from the interface are:
- GetOwnedGameplayTags
- HasMatchingGameplayTag
- HasAllMatchingGameplayTags
- HasAnyMatchingGameplayTags
Tags can be easily edited in Unreal Project Settings under the Gameplay Tags category:
Query Tags with HasMatchingGameplayTag
Using the IGameplayTagAssetInterface we can ask actors multiple things. For instance we can query if they have any gameplay tag using the HasMatchingGameplayTag function.
Ex: If an actor has the gameplay tag CharacterNPC they will respond to queries for the tag Character and for the tag CharacterNPC, but not for the tag CharacterNPCEnemy.
This is useful as it gives as a generic way to ask for the state of the actor. Knowing if a door is locked is as easy as asking if it has the tag InteractableLocked, knowing if the player is invincible means simply asking if the player has the StateInvincible tag.
React to Gameplay Tag Changes
We can easily register to tag changes to know when a tag has been added or removed. This way we can create behavior out of state.
For instance we could have a door that opens when a switch is in the “on” state and it will be as easy as reacting to changes on the tag SwitchStateActivated. If the tag is present we open the door, if the tag goes away we close it.
Same thing can be done for applying Status Effects to characters or reacting to Power Ups.
In Summary
Using Gameplay Tags is a fantastic way to manage the state of your game actors and data.
At the same time they can be easily used to query actor state or react to state changes to create behavior.
Finally, they are editable on the editor, so designers can create and add them without the need of new code.
I hope this encourages you to try out Unreal Engine Gameplay Tags.


