Did you know there’s a way to specify an Actor object by something other than an a reference? I thought this was a handy trick. iOS has a similar “hack”, and it can save your bacon on occasion.
Tagging an Actor in Blueprint
In the Class Defaults of your actor object, head over to Actor section on the right. There’s a small disclosure triangle at the bottom. Click that to expand the section and reveal this:
Tags is an array, and you can add as many text properties here as you like. Click the plus icon to add a tag. Spaces are allowed, although I’m not sure I’d really use them myself. Being an array and all, we can even add multiple tags. Neat!
Tagging an Actor programmatically
Tags can be set at runtime too. We need to make an array of tags, even if we’re only setting a single one, and then add the array to an actor object like so:
Retrieving a Tagged Actor
Now that the object is tagged, how to we identify it again when mingled together with a group of similar objects? The simplest way to find out is by using Actor Has Tag.
You can also get Get All Actors of Class with Tag, giving you an array.