Change light color to random color that constantly changes
I'm messing around in a little project and I am trying to do something with the global directional light. In the level blueprint, I am trying to constantly change the color of the light using an event tick. I just can't figure out how to make a randomly changing RBG variable. So it would go Event Tick -> Set Light Color (Target: Directional Light).
I assume I need to also do a Set color, so I made a LightColor variable. Kinda lost as to what I need to do. Any ideas?
asked Dec 03 '14 at 10:36 AM in Blueprint Scripting
Just saw this tutorial. You can just make a "Random Unit Vector", then convert it to LinearColor, and just set your light's color with the obtained LinearColor.
As described in the tutorial, you can set a timer to choose how often you want the color to be changed.
Hope it helps.
EDIT: Added a simple screenshot of the timer-based Blueprint, that can be found on the tutorial as well.
You can call 3 different "Random float in range", ranging from 0 to 255, and right click on the "Color" Pin of the "Set light color" and split it into float, and then connect every random float to every float. That way, at every tick R will get a random from 0 to 255 and same for G and B. Well on the paper it works, but currently i can't get it working, the light always switch to white and nothing more. But give it a try, i may have missed something on my side
You may also replace float by integer, or clamp the float
Follow this question
Once you sign in you will be able to subscribe for any updates here