Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

Product Version: UE 4.16
more ▼

asked Jun 08 '17 at 10:19 PM in Using UE4

avatar image

71 5 7 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.


more ▼

answered Jun 08 '17 at 10:29 PM

avatar image

2.7k 107 35 180

avatar image v.el Jun 10 '17 at 12:47 PM

Hello, mi friend,

Thank you for help me.

avatar image v.el Jun 12 '17 at 05:37 PM

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?alt text

fullsizerender.jpg (189.2 kB)
avatar image NoobsDeSroobs Jun 12 '17 at 09:53 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question