How to control instances components states of a Class Blueprint?

I have this simply Class Bluprint called “MyLight” (I’m using Top Down template)

as you see it simply toggle the visibility of the “Light” component when player overlap it and Print a String about the light state (ON/OFF). It’s working fine.

I have 6 instances in the scene.

NOW I would like to have something that if all the istances of “Mylight” Light component aren’t visible, print a String: “You win the game!”. Also want to know where I can do it (in a New Bluprint or in the level bluprint)?

thank u!

Howdy,

One way you could tackle it is by using the Is Visible node. In your Level Blueprint, you could add references to your Lights in the level and use the Is Visible condition for the Branches. As long as all your lights are visible, the branch would be false, when all lights are no longer visible, the branch could be true.

I’m sure there’s another way to do it, but this is one way. :slight_smile:

-W

Hi Wes!
it’s working!

http://i59.tinypic.com/e0pvrd.png

Anyway I would like to archive the same result but putting the graphs in a Class Bluprint and “cheking” the visibility for ALL the istances that are present in the scene in one pass: so I can put new istances on scene and don’t need to add manualy every new istance in the Bluprint. In this way I could even move those Bluprints to new proyect or new levels.

do you have any suggestion?
thak u !

  • Create a ‘Light Manager’ Class Blueprint
  • Add to it an array of MyLight pointers
  • From its Begin Play event, use the ‘Find All Actors Of Class’ node to populate the array
  • Each tick, use a For Each node to see if all lights are off