Download

Am I using gameplay tags wrong?

I have my gameplay tags setup like this:
Enemy.AI.Aggressive
Enemy.AI.Scared
Enemy.Stats.Strong
Enemy.Stats.Weak
etc.

This works like a nice folder structure when using tags, BUT the C++ FGameplayTagContainer seems to work backwards?



//pseudo function for forum readability
bool CheckTag(FName name){
return GameplayTags.HasTag(FGameplayTag::RequestGameplayTag(name));
}

CheckTag("Scared"); // Does not work
CheckTag("AI.Scared"); // Does not work

CheckTag("Enemy"); // Works
CheckTag("Enemy.AI"); // Works
CheckTag("Enemy.AI.Scared"); // Works


It seems to look at the tags backwards, looking up the ‘folder’ name instead of the ‘value’ name. It even displays this in the function comment:
{“A.1”}.HasTag(“A”) will return True, {“A”}.HasTag(“A.1”) will return False

Is this working as intended and I’m just using them wrong?

You can use ComplexHasTag() to control the way tags are searched for.