Version: 5.4

Light

class in UnityEngine

/

다음으로부터 상속:Behaviour

매뉴얼로 전환

설명

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

변수

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.
colorThe color of the light.
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).
rangeThe range of the light.
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
shadowStrengthStrength of light's shadows.
spotAngleThe angle of the light's spotlight cone in degrees.
typeThe type of the light.

Public 함수

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.

상속된 멤버

변수

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledHas the Behaviour had enabled called.
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject (null if there is none attached).
hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.

Public 함수

BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

정적 함수

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateReturns a copy of the object original.

연산자

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.