Camera.backgroundColor Manual     Reference     Scripting  
Scripting > Runtime Classes > Camera
Camera.backgroundColor

var backgroundColor : Color

Description

The color with which the screen will be cleared.

Only used if clearFlags are set to CameraClearFlags.SolidColor (or CameraClearFlags.Skybox but the skybox is not set up).

// ping-pong animate background color
var color1 = Color.red;
var color2 = Color.blue;
var duration = 3.0;

// Set clear flags to color
camera.clearFlags = CameraClearFlags.SolidColor;

function Update () {
var t = Mathf.PingPong (Time.time, duration) / duration;
camera.backgroundColor = Color.Lerp (color1, color2, t);
}

See Also: camera component, Camera.clearFlags property.