- Home /
Lerping between two colors to create day/night effect in unity2D
hey all!
I'm trying to make a day night cycle, well not trying I've almost finished but I need to create a sunset effect , so my first guess was to lerp between three colors, blue for morning and then orange for sunrise and then orange to a dark greyish color but unfortunately it wouldn't work, I did this by trying to change the background color on the camera since my game camera is front facing a bit like terraria's (I'm not making a terraria clone :D ) , the color of the background went from blue to dark grey straight away, I'm not really sure if this is the best approach to deal with a day/night cycle, but hopefully you guys can help me out a bit, thanks !
Answer by MUGIK · Nov 06, 2016 at 11:24 AM
Just use Gradient and Evaluate method: https://docs.unity3d.com/ScriptReference/Gradient.Evaluate.html
you my sir are amazing , it worked like a charm thank you(I awarded you some points)
Your answer
Follow this Question
Related Questions
How to make a day/night cycle like in Alto's adventure in Unity? 0 Answers
UI Buttons are not pressing. ,I have a UI button, but for some reason it won't press. 1 Answer
How to change UI button of a particular gameobject to another UI button 1 Answer
Parse JSON Data with JSON Utility to Dictionary object 1 Answer
Change image in UI depending on the value of the slider 0 Answers