Daily Unreal Column #45 - Child Gameplay Tags
The way gameplay tags are structured, it is possible to get all "child" gameplay tags based on a "parent" gameplay tag name. Here is how.
Looking at Lyra's gameplay tags you can immediately see what I mean by child-parent relation between tags. When we declare these two gameplay tags
ActivationFail.IsDead
ActivationFail.Cooldown
the ActivationFail
is the parent gameplay tag, and both IsDead
and Cooldown
are being children to it.
Now using following code you can fetch all child gameplay tags whose parent is ActivationFail
.
const FGameplayTag ParentTag = FGameplayTag::RequestGameplayTag("Ability.ActivateFail");
UGameplayTagsManager& GameplayTagManager = UGameplayTagsManager::Get();
FGameplayTagContainer ChildTags = GameplayTagManager.RequestGameplayTagChildren(ParentTag);
When we print all tags contained in the gameplay tag container this will be the result:
Log LogTemp Ability.ActivateFail.ActivationGroup
Log LogTemp Ability.ActivateFail.CellAlreadyContainsBomb
Log LogTemp Ability.ActivateFail.Cooldown
Log LogTemp Ability.ActivateFail.Cost
Log LogTemp Ability.ActivateFail.IsDead
Log LogTemp Ability.ActivateFail.MagazineFull
Log LogTemp Ability.ActivateFail.Networking
Log LogTemp Ability.ActivateFail.NoSpareAmmo
Log LogTemp Ability.ActivateFail.TagsBlocked
Log LogTemp Ability.ActivateFail.TagsMissing