FGameplayTag at runtime?

How to create FGameplayTag at runtime? I tried to do this but its in private scope.



static const FName MY_TAG_NAME = "MyRuntimeTag";
FGameplayTag MyTag = FGameplayTag(MY_TAG_NAME);


bumpy bump

You can’t and that’s intentional. Gameplay tags are organized in complex data structure, which is reconstructed when new tags are added.
Once tags are added, they reside inside memory and shouldn’t be modified at runtime.


UGameplayTagsManager::Get().RequestGameplayTag(TEXT("Some.Tag.FName"))

The function has a second optional parameter telling it whether or not it should throw a tantrum if the tag in question isn’t found.

Edit:

If you actually want to CREATE a new tag, rather than look up an existing one, you can use:


UGameplayTagsManager::Get().AddNativeGameplayTag("TagName")

…but this can only be used during engine initialization.