GAS - Get Tag's children as list

Hi,

I’m creating a function in my Gameplay Ability System parent class that depends on active tags of a certain tag parent, in this case “char.boost”. Depending on the children present I want to execute different logic.

i.e: char.boost.cooldownReduction and char.boost.slow are active so I would only execute their respective nodes.

I currently have something like this but this can’t be the best way of doing this.

Perhaps getting a list of tag’s children and then plugging that into a form of Switch ?

Thanks in advance

1 Like

I think I’ve found a solution to this after looking around a bit more.

2 Likes

You can get tag children with

// Make tag container
FGameplayTagContainer Container = UGameplayTagsManager::Get().RequestGameplayTagChildren(ParentTag);

// Get tags as array
TArray<FGameplayTag> TagArray;
UBlueprintGameplayTagLibrary::BreakGameplayTagContainer(Container, TagArray);

// or like this
TArray<FGameplayTag> TagArray1 = Container.GetGameplayTagArray()

// iterate
for (const FGameplayTag& Tag : TagArray)
{
    ....
}