c# - how to slowly change the skybox color in unity 5 -
i trying change color or tint of skybox slowl turn black. have looked while , still cant find on this. here code right now:
using unityengine; using system.collections; public class skyboxcolorchanger : monobehaviour { public color colorstart = color.blue; public color colorend = color.red; public float duration = 1.0f; void start () { } void update () { float lerp = mathf.pingpong(time.time, duration) / duration; rendersettings.skybox.setcolor("_tint", color.lerp(colorstart, colorend, lerp)); } } the problems 1 are:
in options appears work if sky solid color.
when did work changed @ fast rate (im looking long time between changes).
thanks looking!
try this:
public float step = 0; void update () { rendersettings.skybox.setcolor("_tint", color.lerp(colorstart, colorend, step)); step += time.deltatime / duration; }
Comments
Post a Comment