How to check an individual state with multiple copies of blueprint class in the level?


I have a simple level that has several buttons (coming from the same blueprint class) and to each of those I assigned a random predefined color (randomly choosing between 4 colors) at the start of the game. The player then has the ability to switch the color of each button, so it cycles between those 4 predefined colors. Up to this point everything is running smoothly. Now I would like to fire an event (like opening a door) but only when all buttons are switched to red (the way I set the colors randomly at the start is with random integer variable, so red = 2). I have no idea how to fire an event based on the color state of all the copies of this blueprint button in the level. If someone could offer a hint on how to approach this I would be very grateful. Thank you!

Ah, I think I found a solution. The trick is in using Event Dispatchers to have each blueprint instance report its state to Level Blueprint through an event. From then on it’s pretty straightforward, setting up a bool variable for each instance and executing the event when they’re all true.