Light.range Manual     Reference     Scripting  
Scripting > Runtime Classes > Light
Light.range

var range : float

Description

The range of the light.

Even if the light has attenuate off, it still affects only objects within its range.

// Pulse light's range between original range
// and half of the original one

var duration = 3.0;
private var originalRange : float;
originalRange = light.range;

function Update() {
var amplitude = Mathf.PingPong( Time.time, duration );
// transform from 0..duration to 0.5..1 range
amplitude = amplitude / duration * 0.5 + 0.5;
// set light range
light.range = originalRange * amplitude;
}

See Also: Light component