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

var spotAngle : float

Description

The light's spotlight angle in degrees.

Used primarily for Spot lights. Alters the light cookie size on Directional lights. No effect for Point lights

// Change spot angle randomly between 'minAngle' and 'maxAngle'
// each 'interval' seconds.
var interval = 0.3;
var minAngle = 10;
var maxAngle = 90;
private var timeLeft : float;

timeLeft = interval;
light.type = LightType.Spot;

function Update () {
timeLeft -= Time.deltaTime;
if (timeLeft < 0.0) {
// time to change!
timeLeft = interval;
light.spotAngle = Random.Range( minAngle, maxAngle );
}
}

See Also: Light component