Download

switch predefined colors

How can I switch through predefined colors ?
Lets say I will define some rgb values for a light like a red, a green and a blue for example and run through
the values by pressing a button.
Any idea ?
Below is my current setup. At the moment I have a random color rgb value, seen in a ue4 tutorial.

You can make a Variable with a type of Linear Color Array. Compile it and then u will be able to set the colors to this array in Details panel. After this just use Get function to use ur predefined colors.
08f2bcc7ec3b3bf6ca66efbe7e28b3d32e7788c9.png

You can use MultiGate for cycling through colors and use the array method AlFlakky mentioned for storing colors
843c6fbd7785e491be5ee3a99be3682abbdc5b30.jpeg

Thank you very much. Here is the setting:

Last question: How can I run through the index numbers from the get node with my G key ?
So every time I hit the G key the next index number comes up.

The Multigate is cool but tricky in my case: Every hit I do on the G key the node uses only one output pin.
But I want to change all 3 parameters with one hit.

You can use multigate to execute all 3 parameters like a regular graph. The only reason I’d not use multigate would be if there was an infinite or variable amount of elements in the array.

What you could do to cycle through the array elements using the Get node would be having a variable “Current Index” plugged to the Get index input that adds a +1 after every execution. To have it loop you would need to get the array length (-1). If the Current Index exceeds the array length, then reset back to 0. If you are interested in this method, I can show you an example when I get back to my PC.

Of course I am interested :wink:
Thanks

Woops, sorry. Totally forgot about this thread.

Anyways, here are the two methods.


Using a multigate would work as long as you know the amount of elements your color array will have but it can be messy as the count gets higher, so I would only recommend this for two or three array elements.


Using a variable to loop through array elements would result in a much cleaner graph and will support any number of array elements. Just create an integer variable to store the current index.

I checked out the second setup and YESSS, it works perfect. Thank you very much :cool: