How to Create many buttons and change your colors randomly

Create an array of all these buttons and then, in tick, do the following.

Make a variable called TotalTime that you keep adding DeltaTime from tick to. Then, when this value is larger than 1, increment another variable called Index and use it to access the array. Give the array element the random color. MAKE SURE YOU REMEMBER to remove 1 from the TotalTime variable.

There is one final problem that you have to solve. What happens after all buttons are done? The easiest way to avoid having the code try to access an element outside the scope of the array is to put a Gate node right after the Tick node and when TotalTime > NumButtons you close the gate.


Just add the button to another array. Then, when searching the colour array for a matching colour you use the result as the index in the button array.

I created a UMG with 25 buttons using Unreal 4.16 version, and wanted to do the following:

The buttons are white, and every second each button changes color randomly until all the buttons change color and when this happens, the event stops;
Could someone help me create an array logic to do this using Get Background Color, Break Linear Color in BluePrint?

Thank you so much.


Hello, mi friend,

Thank you for help me.

My Friend, thank you once more for the help. I was able to make the colors appear on the buttons randomly, now I need one more help, please. I created a logic and in this logic happens the following: When I trigger a button, I capture the color of this button using the component GetBackGroundColor and then I create an array with that same color. I would like to know if there is a way to do the opposite way, ie from the captured color and inserted into the color array, identify which button was captured that color?