Download

Understanding Tags

Hello fellow devs!

After some years of Unity I’m now trying to get out of my comfort zone and learn the UE! After some tutorials I am now working on my first game, nothing too complex of course, just something to get accustomed to a new way of thinking.

The main problem, as you may have guessed from the titles, is to understand how tags work. I have read about the GameplayTags options in the project preferences, and I’ve also noticed the tags field in Actors and Components inspector, but I really don’t understand how those system are supposed to be used, on what they differ, and when one should be prefered to another. Can anyone help me understand them better?

What really interests me right now is optimization, I have an Actor with a specific Component, and every object I instantiate in the scene needs to have a reference to them straight away. Currently, I have a C++ class that extends APawn and overrides PostActorCreated(), searching for every object with a specific name (I know this would be easier with blueprints, but I’d stick to C++ for the time being), which is pretty expensive on larger scenes. For this reason I thought of Tags, in Unity searching objects by tags is a nice way to optimize search. Is it the same in Unreal? Is there any better way to do such a thing?