Version: 2023.2
言語: 日本語


class in UnityEngine





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.


using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Make a game object GameObject lightGameObject = new GameObject("The Light");

// Add the light component Light lightComp = lightGameObject.AddComponent<Light>();

// Set color and position lightComp.color =;

// Set the position (or any transform property) lightGameObject.transform.position = new Vector3(0, 5, 0); } }


areaSizeThe size of the area light (Editor only).
bakingOutputThis property describes the output of the last Global Illumination bake.
boundingSphereOverrideBounding sphere used to override the regular light bounding sphere during culling.
colorTemperature The color temperature of the light. Correlated Color Temperature (abbreviated as CCT) is multiplied with the color filter when calculating the final color of a light source. The color temperature of the electromagnetic radiation emitted from an ideal black body is defined as its surface temperature in Kelvin. White is 6500K according to the D65 standard. A candle light is 1800K and a soft warm light bulb is 2700K. If you want to use colorTemperature, GraphicsSettings.lightsUseLinearIntensity and Light.useColorTemperature has to be enabled. Additional resources: GraphicsSettings.lightsUseLinearIntensity, GraphicsSettings.useColorTemperature.
commandBufferCountこのライトを設定するコマンドバッファーの数 (Read Only)
cullingMaskThis is used to light certain objects in the Scene selectively.
dilatedRange The Light.range property describes the range of each point on the light. However, area lights consist of several light-emitting points, and so the effective range is a bit larger, and depends on the size of the area light. This property returns this larger range. Use this property to find whether a given world-space point will be lit by the area light. If not an area light, then returns the same value as Light.range.
flareライトに フレア を使用する。
innerSpotAngleThe angle of the spot light's inner cone in degrees.
layerShadowCullDistancesPer-light, per-layer shadow culling distances. Directional lights only.
lightmapBakeTypeThis property describes what part of a light's contribution can be baked (Editor only).
lightShadowCasterModeAllows you to override the global Shadowmask Mode per light. Only use this with render pipelines that can handle per light Shadowmask modes. Incompatible with the legacy renderers.
range The range of each point of the light. Since area lights have a light emitting surface instead of a single point, the cumulative range of the light is larger than this property. This larger range can be read from the Light.dilatedRange property. For non-area lights, Light.range and Light.dilatedRange return the same value.
renderingLayerMaskDetermines which rendering LayerMask this Light affects.
shadowAngleControls the amount of artificial softening applied to the edges of shadows cast by directional lights (Editor only).
shadowMatrixOverrideMatrix that overrides the regular light projection matrix during shadow culling. Unity uses this matrix if you set Light.useShadowMatrixOverride to true.
shadowRadiusControls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light (Editor only).
shadowResolutionThe resolution of the shadow map.
spotAngleThe angle of the spot light's cone in degrees.
useBoundingSphereOverrideSet to true to override light bounding sphere for culling.
useColorTemperatureSet to true to use the color temperature.
useShadowMatrixOverrideSet to true to enable custom matrix for culling during shadows.
useViewFrustumForShadowCasterCullWhether to cull shadows for this Light when the Light is outside of the view frustum.

Public 関数

AddCommandBufferAsyncAdds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point.
ResetRevert all light parameters to default.
SetLightDirtySets a light dirty to notify the light baking backends to update their internal light representation (Editor only).



isActiveAndEnabledReports whether a GameObject and its associated Behaviour is active and enabled.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?

Public 関数

BroadcastMessageゲームオブジェクトまたは子オブジェクトにあるすべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。
CompareTagChecks the GameObject's tag against the defined tag.
GetComponentGets a reference to a component of type T on the same GameObject as the component specified.
GetComponentInChildrenGets a reference to a component of type T on the same GameObject as the component specified, or any child of the GameObject.
GetComponentInParentGets a reference to a component of type T on the same GameObject as the component specified, or any parent of the GameObject.
GetComponentsGets references to all components of type T on the same GameObject as the component specified.
GetComponentsInChildrenGets references to all components of type T on the same GameObject as the component specified, and any child of the GameObject.
GetComponentsInParentGets references to all components of type T on the same GameObject as the component specified, and any parent of the GameObject.
SendMessageゲームオブジェクトにアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します
SendMessageUpwardsゲームオブジェクトと親(の親、さらに親 ... )にアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します
TryGetComponentGets the component of the specified type, if it exists.
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static 関数

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします


operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。