Convert string to object reference dynamically?

Hi, is there a command to convert a string to an object reference? I have 11 lights in my blueprint (“Spotlight1” to “Spotlight11”), I’d like to perform the same set of commands on all of them on a key press.

Can I use a For Loop to generate the component name, and then pass that as the target to instructions like ‘Toggle Visibility’?

If they are all of the same class, you can use Get Components by Class to get an array of the components, then use a ForEach Loop to do something to each of them.

There’s also Get Components by Tag if you just need a subset of them.


Thanks - I think I’m there now.