Gameplay Tags Can't Be Edited As Keys In Maps?

For some reason when using gameplay tags as a map key I am unable to edit the value.

129064-ue4_008.png

I’m not sure if this is a bug or its something on my end.

(This was just me experimenting with gameplay tags btw)

My current RPG Stat system is basically a Map With a Name as the key and a custom struct as the value.

Since 4.15 Gameplay Tags Are now Supported so i created a New Project To Mess around With All The New Toys.

One of the ideas i had was instead of using a Name As my map key i would instead move over to gameplay tags since i like how Organized it is compared to my current system.

What i am trying to do is Use this example Gameplay tag i made in a new project and simply Use It as a Map Key…

Gameplay tags work fine in an Array, Set Or as a map value but not as a map key for some reason.

i’m not sure if this is a bug or maybe tags cant be map keys, and before anyone says gameplay tags can’t be used as a map key, if that’s true why don’t error message when i set it? try using a transform or bool as a map key it wont work.

What are you trying to do exactly? That’s not how GameplayTags are supposed to be used as far as I know.

now i believe its a bug see image below.

i can clearly add gameplay tags In PIE and in standalone without Errors or crashes.

(ill try in a packaged game later)

I’m guessing Epic forgot to add the edit button for Maps.

The thing is that not every combination of variables works as a map. It doesn’t really tell you either.

I don’t think you understand how GameplayTags work. You’re supposed to add them to individual actors and query them. It’s a way to identify what an actor is without having to cast to it first. Putting it in an array or map doesn’t even make sense.

Creating a TMap<FGameplayTag, anything> works in editor, but not in packaged game. I put such a variable in a DataAsset and filled in some values; while it works in editor, in packaged game the variable comes up empty.

Did you find a way to make it work? I’m planning to do something similar

Some discuss first here, but for those who want go straight to the answer Jump into Summary section .
I have faced the same problem, cause I use DataHandle workflow to…
・Contain multiple of Data in one Actor.
・To accessing them easily, and to avoid hard refference worries.
・And for Debbug stuff too, cause GameInstance doesn’t have any tick solution in the first place.

It’s basically an actor with no class reference , but with a bunch of simple variable and low cost memory, so I tought accessing all classes tag via DataHandle is more convinient workflow than using bunch of interface or accessing with cast, or something else.

Summary➤

And here is the replacement method for this. The key is Component using component you can create any type of variable at runtime. This could resolve many problem you are facing with blueprint logics.

1.So, I created GampleyTagComponet that contain a ObjectReferenceClass and Container in it.
image

2.Then I created event that creates GameplayTag at runtime by taking other class self instance.

3.DataHandle take that self instance and pass to Directly in Register Macro


Add elem to empty space is an custom macro I already posted on my twitter here :

and Random Id macro is simply an macro that generate random Id every tick that I used for performance test, but actually you need to store the class name for accessing tag particularly later.

4.Now you need to access, those tag so here is GameplayTag(Self)and Other Referenceand Add/Remove TagMacro


Now you are good to go!

There is no problem with performance , I tested with more than million actorcomponent and try to find by its tag. Maybe 10k-100k around wouldn’t affect on FPS. If you need more , I think you will need to create an custom find by tag function that get child length and separate into 10k and split the process to the next tick, or making more smart reusable actor to avoid overhead.

I know that there is no problem in these warning ,but it’s annoying and I wanna know how to get rid of them without separating the nodes.