I want to change camera background color randomly from 50 to 200 every 5 seconds. How to do that?
i am using below scrip but its not working.
public class Camera_cript : MonoBehaviour {
Color bgcolor = Color.white;
Color current = Color.black;
Camera camera;
public float duration = 3.0F;
// Use this for initialization
void Start ()
{
camera = GetComponent<Camera> ();
}
void Update ()
{
float t = Mathf.PingPong(Time.time, duration) / duration;
camera.backgroundColor = Color.Lerp(current,bgcolor,0.5f);
}
}