Version: 5.4

Light

class in UnityEngine

/

Hereda de:Behaviour

Cambiar al Manual

Descripción

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); } }

Variables

areaSizeThe size of the area light. Editor only.
bakedIndexA unique index, used internally for identifying lights contributing to lightmaps and/or light probes.
bounceIntensityThe multiplier that defines the strength of the bounce lighting.
colorEl color de la luz.
commandBufferCountNumber of command buffers set up on this light (Read Only).
cookieThe cookie texture projected by the light.
cookieSizeThe size of a directional light's cookie.
cullingMaskThis is used to light certain objects in the scene selectively.
flareThe flare asset to use for this light.
intensityThe Intensity of a light is multiplied with the Light color.
isBakedIs the light contribution already stored in lightmaps and/or lightprobes (Read Only).
rangeEl rango de la luz.
renderModeHow to render the light.
shadowBiasShadow mapping constant bias.
shadowCustomResolutionThe custom resolution of the shadow map.
shadowNearPlaneNear plane value to use for shadow frustums.
shadowNormalBiasShadow mapping normal-based bias.
shadowResolutionControl the resolution of the ShadowMap.
shadowsHow this light casts shadows
shadowStrengthFuerza de las sombras de la luz.
spotAngleThe angle of the light's spotlight cone in degrees.
typeEl tipo de luz.

Funciones Públicas

AddCommandBufferAdd a command buffer to be executed at a specified place.
GetCommandBuffersGet command buffers to be executed at a specified place.
RemoveAllCommandBuffersRemove all command buffers set on this light.
RemoveCommandBufferRemove command buffer from execution at a specified place.
RemoveCommandBuffersRemove command buffers from execution at a specified place.

Miembros heredados

Variables

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledHas the Behaviour had enabled called.
gameObjectEl game object que tiene este componente adjunto. Un componente siempre está adjunto a un game object.
tagEl tag de este game object.
transformEl 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?
nameEl nombre del objeto.

Funciones Públicas

BroadcastMessageLlama 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?
GetComponentDevuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene.
GetComponentInChildrenRetorna el componente de tipo type en el GameObject o cualquiera de sus hijos utilizando depth first search (busqueda de profundidad).
GetComponentInParentRetorna el componente de tipo type en el GameObject o cualquiera de sus padres.
GetComponentsRetorna todos los componentes de tipo type en el GameObject.
GetComponentsInChildrenRetorna todos los componentes de tipo type en el GameObject o cualquiera de sus hijo.
GetComponentsInParentRetorna todos los componentes de tipo type en el GameObject o cualquiera de sus padres.
SendMessageLlama al método denominado methodName en cada MonoBehaviour de este game object.
SendMessageUpwardsLlama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour.
GetInstanceIDDevuelve el id de la instancia del objeto.
ToStringDevuelve el nombre del objeto.

Funciones Estáticas

DestroyElimina un gameobject, componente o asset.
DestroyImmediateDestruye el objeto obj inmediatamente.
DontDestroyOnLoadHace que el objeto target no sea destruido automáticamente cuando se cargue una nueva escena.
FindObjectOfTypeDevuelve el primer objeto activo cargado de tipo type.
FindObjectsOfTypeDevuelve una lista de todos los objetos activos cargados de tipo type.
InstantiateDevuelve una copia del objeto original.

Operadores

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.