Skip to content

Tag Containers

A GameplayTagContainer stores a collection of Gameplay Tags:

Faction.Enemy
Character.State.Burning
Damage.Resistance.Fire
Interaction.Usable

An object can therefore be an enemy, burning, fire-resistant, and usable without four unrelated booleans.

Operation Meaning
Add Add a non-empty tag unless it is already present.
Remove Remove a tag if present.
Clear Remove every tag.
Has Tag Check one tag.
Has Any Require at least one tag from a query container.
Has All Require every tag from a query container.
Equals Exact Compare the complete tag sets.
Union Create a container with tags from both inputs.
Intersect Create a container with exact tags shared by both inputs.

Containers normalize and sort their contents. Matching can be exact or use a parent query:

Owned: Damage.Type.Fire
Query: Damage.Type
Include Children: true
Result: true

Some states are mutually exclusive within the same parent category:

Quest.Main.Available
Quest.Main.Active
Quest.Main.Completed

The Game Creator integration includes Actions for setting one exclusive child, changing a parent group, cycling sibling tags, and clearing children under a parent. Use them when the hierarchy itself defines the exclusive group.

  • Empty None tags and duplicates are ignored.
  • Clearing an empty container and removing an absent tag are no-ops.
  • Service and component APIs resolve configured redirects.
  • Undefined tags can warn in the Editor or development builds.
using SkywardGames.Runtime.GameplayTags;
using UnityEngine;
public class BurningState : MonoBehaviour
{
[SerializeField] private GameplayTagComponent tags;
private static readonly GameplayTag Burning =
GameplayTag.FromPath("Character.State.Burning");
public void Apply()
{
tags.AddTag(Burning);
}
public void Remove()
{
tags.RemoveTag(Burning);
}
}