Script interface for light components.
Use this to control all aspects of Unity's lights. The properties are an exact match for the
values shown in the Inspector.
Usually lights are just created in the editor but sometimes you want to create a light from a script:
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Start() { GameObject lightGameObject = new GameObject("The Light"); Light lightComp = lightGameObject.AddComponent<Light>(); lightComp.color = Color.blue; lightGameObject.transform.position = new Vector3(0, 5, 0); } }
areaSize | The size of the area light. Editor only. |
bakedIndex | A unique index, used internally for identifying lights contributing to lightmaps and/or light probes. |
bounceIntensity | The multiplier that defines the strength of the bounce lighting. |
color | El color de la luz. |
commandBufferCount | Number of command buffers set up on this light (Read Only). |
cookie | The cookie texture projected by the light. |
cookieSize | The size of a directional light's cookie. |
cullingMask | This is used to light certain objects in the scene selectively. |
flare | The flare asset to use for this light. |
intensity | The Intensity of a light is multiplied with the Light color. |
isBaked | Is the light contribution already stored in lightmaps and/or lightprobes (Read Only). |
range | El rango de la luz. |
renderMode | How to render the light. |
shadowBias | Shadow mapping constant bias. |
shadowCustomResolution | The custom resolution of the shadow map. |
shadowNearPlane | Near plane value to use for shadow frustums. |
shadowNormalBias | Shadow mapping normal-based bias. |
shadowResolution | Control the resolution of the ShadowMap. |
shadows | How this light casts shadows |
shadowStrength | Fuerza de las sombras de la luz. |
spotAngle | The angle of the light's spotlight cone in degrees. |
type | El tipo de luz. |
AddCommandBuffer | Add a command buffer to be executed at a specified place. |
GetCommandBuffers | Get command buffers to be executed at a specified place. |
RemoveAllCommandBuffers | Remove all command buffers set on this light. |
RemoveCommandBuffer | Remove command buffer from execution at a specified place. |
RemoveCommandBuffers | Remove command buffers from execution at a specified place. |
enabled | Enabled Behaviours are Updated, disabled Behaviours are not. |
isActiveAndEnabled | Has the Behaviour had enabled called. |
gameObject | El game object que tiene este componente adjunto. Un componente siempre está adjunto a un game object. |
tag | El tag de este game object. |
transform | El Transform adjunto a este GameObject (null si no hay uno adjunto). |
hideFlags | ¿Debería el objeto estar oculto, guardado con la escena o modificable por el usuario? |
name | El nombre del objeto. |
BroadcastMessage | Llama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos. |
CompareTag | ¿Este game object está etiquetado con tag? |
GetComponent | Devuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene. |
GetComponentInChildren | Retorna el componente de tipo type en el GameObject o cualquiera de sus hijos utilizando depth first search (busqueda de profundidad). |
GetComponentInParent | Retorna el componente de tipo type en el GameObject o cualquiera de sus padres. |
GetComponents | Retorna todos los componentes de tipo type en el GameObject. |
GetComponentsInChildren | Retorna todos los componentes de tipo type en el GameObject o cualquiera de sus hijo. |
GetComponentsInParent | Retorna todos los componentes de tipo type en el GameObject o cualquiera de sus padres. |
SendMessage | Llama al método denominado methodName en cada MonoBehaviour de este game object. |
SendMessageUpwards | Llama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour. |
GetInstanceID | Devuelve el id de la instancia del objeto. |
ToString | Devuelve el nombre del objeto. |
Destroy | Elimina un gameobject, componente o asset. |
DestroyImmediate | Destruye el objeto obj inmediatamente. |
DontDestroyOnLoad | Hace que el objeto target no sea destruido automáticamente cuando se cargue una nueva escena. |
FindObjectOfType | Devuelve el primer objeto activo cargado de tipo type. |
FindObjectsOfType | Devuelve una lista de todos los objetos activos cargados de tipo type. |
Instantiate | Devuelve una copia del objeto original. |
bool | ¿Existe el objeto? |
operator != | Compare si dos objetos se refieren a un objeto diferente. |
operator == | Compara dos referencias de objeto para ver si se refieren al mismo objeto. |