How do I find a variant of a specific actor in an array?

Hey, everyone. As the title says, how do I achieve it? In my scene, I have an actor BP_FloorLight which is scattered across a house in the level. Now I have trigger boxes setup and whenever my character overlaps, I turn on a Point Light attached in a BP_FloorLight. My current setup of this is that I use the Get All Actors of Class to find all of my BP_FloorLight, then place them in an array. And then just use the get node to find the instance of the BP_FloorLight that I want to turn on. However, this sometimes doesn’t work since their placements in the array isn’t guaranteed. For example, BP_FloorLight1 can be assigned the Element Index of 1 but the next time I test it, BP_FloorLight1 can be assigned the Element Index of 2 therefore breaking my code.

In this case, how can I call a specific instance of an actor? I’m thinking that my approach in doing this is wrong. Any help will do! Thank you in advance!

  • why not connect a specific light to a specific trigger since they’re both in the level?
  • or even make an actor that has both: trigger and light.

The 2nd option encapsulates all components in a single actor; those comps can be edited on per-instance basis, placed wherever in the level:

You enter this collision volume and these lights trigger.


It would be a different story if you needed to reparent a trigger + light pair dynamically during gameplay.

2 Likes

Thanks for the reply! :slight_smile: I’m trying to do the first option, is this how the structure of the Blueprint supposed to be?

This is the 2nd option already. I would attach all components to the root so if you move the trigger the light stays where it was.

1 Like

This is much better than I expected. Thank you!

1 Like

Hello again. I was wondering if maybe you have an idea what seems to be wrong with what I am trying to achieve?

The Blueprints above works really well in my project, but I am having an issue when I have a trigger box with a UI in world space. Basically I have 3 buttons that summon an actor. When my character overlaps it triggers the lights, but whenever I click one of the buttons, the lights always turns off for some reason.

Can we see this bit?

Here’s the Blueprint for this bit.

Just basically summons another Blueprint Actor.

I don’t understand how it’s supposed to work. You say you click a button and lights turn off.

If you destroy the actor that had the light, the light is gone. Is this what is happening?

Nowhere above am I seeing the button attempting to interact with any lights.