Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Light.spotAngle

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public var spotAngle: float;
public float spotAngle;

Descripción

The angle of the light's spotlight cone in degrees.

This is used primarily for Spot lights and has no effect for Point lights See Also: Light component.

// Change spot angle randomly between 'minAngle' and 'maxAngle'
// each 'interval' seconds.

var interval : float = 0.3; var minAngle : float = 10; var maxAngle : float = 90; var timeLeft : float;

var lt: Light;

function Start() { lt = GetComponent.<Light>(); lt.type = LightType.Spot; timeLeft = interval; }

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

public class ExampleClass : MonoBehaviour { public float interval = 0.3F; public float minAngle = 10; public float maxAngle = 90; public float timeLeft; public Light lt; void Start() { lt = GetComponent<Light>(); lt.type = LightType.Spot; timeLeft = interval; } void Update() { timeLeft -= Time.deltaTime; if (timeLeft < 0.0F) { timeLeft = interval; lt.spotAngle = Random.Range(minAngle, maxAngle); } } }