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:

  1. in options appears work if sky solid color.

  2. 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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -