How to Create many buttons and change your colors randomly
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.
asked Jun 08 '17 at 10:19 PM in Using UE4
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.
answered Jun 08 '17 at 10:29 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here