Download

Multiple light switch through array

I am new with Blueprints. I was able to make a UI widget and use a button to toggle multiple lights successfully:

But when I used an Array of lights for better control it just doesn’t work:


It should be a small error but I am not able to find proper answer online yet. Any help?

It looks like you are only getting the first light, but as you are looping through the array, you are toggling the light a number of times. (The same number as the length of the array). This means that if you have an even number in the array, you will toggle the light an even number of times. You are switching it on and switching it off again!

If you just want to control the first light only, delete the Make Array and the For Each Loop, and just connect the GET to the Target.

It’s not allowing me to connect Get directly to the For Each Loop Array without forcing the Make Array in between.

And it didn’t toggle the lights as you told me:

He means the “Get All Actors” directly into “For each loop”.

Thanks… issue solved. I was connecting the Get directly to the Array of For Each Loop without referencing it to the Blueprint actor first.