Download

How do you add a tag to a component?

There’s a component has tag function, to see what tag a component has, but I can’t figure out how to add tags to components in the editor, only to actors once they are placed in the world. I want to be able to add tags to components so I can run true/false against them and do various things with that.

if you mean procedurally or after game launched, you can get the actor first(depending on how you got it), then cast to a proper class that you know will have the component, then get the component, you will then be able to set tags on that component.

Thank you so much for the reply! Been spinning my wheels here. Ideally, I’d like to just be able to add a tag to a mesh asset right in the editor. I’m working with construction scripts for building a level and I want to be able to check in the blueprint to see if an object has X tag, etc. I’m loading my meshes in, in an array so if the mesh asset itself had a tag that would be ideal but I don’t see any way to add those in the editor unless the asset is an actor and not simply a mesh.

Don’t ask in two places please. It makes people spend their time answering your question while it may have already been answered in your other thread: https://forums.unrealengine.com/showthread.php?5139-Can-you-add-tags-to-static-meshes-or-only-to-actors

Alternatively to my solution above you can add a Socket to a mesh, and then you can run “Does Mesh Has Socket”, which outputs a bool. That way you can check if a Socket “Window” or “Door” exists to determine what kind of mesh it is.

The socket idea is really smart! Sorry if the questions sounded similar, in the other thread I was trying to ask if tags could be placed on arbitrary mesh’s in the editor outside of the blueprint. Think I got carried away looking for solutions :slight_smile:

By the way, I’ve been pouring over your tutorials and videos that you’ve released. Thank you for taking the time to create those, very helpful stuff and Solus looks fantastic.

Click on the component you want to tag in the Components tab of your actor blueprint. There should be a ‘Tags’ section in the Details panel.