Version: 2022.3
言語: 日本語

Light

class in UnityEngine

/

継承:Behaviour

マニュアルに切り替える

説明

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 = Color.blue;

// 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.
bounceIntensityバウンスライトの強さを定義する乗数です。
boundingSphereOverrideBounding sphere used to override the regular light bounding sphere during culling.
colorライトのカラーを設定する。
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. See Also: GraphicsSettings.lightsUseLinearIntensity, GraphicsSettings.useColorTemperature.
commandBufferCountこのライトを設定するコマンドバッファーの数 (Read Only)
cookieライトで投影するクッキーを設定する。
cookieSizeディレクショナルライトのクッキーのサイズ
cullingMaskThis is used to light certain objects in the Scene selectively.
flareライトに フレア を使用する。
innerSpotAngleThe angle of the light's spotlight inner cone in degrees.
intensityライトの強度はライトのカラーで乗算されます。
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ライトの大きさを設定する。
renderingLayerMaskDetermines which rendering LayerMask this Light affects.
renderModeレンダリングするモードを設定する。
shadowAngleControls the amount of artificial softening applied to the edges of shadows cast by directional lights.
shadowBiasシャドウマッピングのバイアス
shadowCustomResolutionシャドウマップのカスタムの解像度。
shadowMatrixOverrideMatrix that overrides the regular light projection matrix during shadow culling. Unity uses this matrix if you set Light.useShadowMatrixOverride to true.
shadowNearPlaneシャドウ視錐台に使用する近い方の平面の値
shadowNormalBiasノーマルベースバイアスのシャドウマッピング
shadowRadiusControls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light.
shadowResolutionThe resolution of the shadow map.
shadowsどのようにこのライトが影を落とすか。
shadowStrength影の強さを設定します。
shapeThis property describes the shape of the spot light. Only Scriptable Render Pipelines use this property; the built-in renderer does not support it.
spotAngleスポットライトのアングルの角度を設定する。
typeライトの種類を設定する。
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 関数

AddCommandBuffer指定された場所で実行されるようコマンドバッファを追加します。
AddCommandBufferAsyncAdds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point.
GetCommandBuffers指定された場所で実行されるようにコマンドバッファを取得します。
RemoveAllCommandBuffersこのライトに設定するすべてのコマンドバッファーを削除します。
RemoveCommandBuffer指定された場所で実行からコマンドバッファを削除します。
RemoveCommandBuffers指定された場所で実行からコマンドバッファを削除してください。
ResetRevert all light parameters to default.
SetLightDirtySets a light dirty to notify the light baking backends to update their internal light representation (Editor only).

継承メンバー

変数

enabled有効であれば更新され、無効であれば更新されません。
isActiveAndEnabledReports whether a GameObject and its associated Behaviour is active and enabled.
gameObjectこのコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。
tagゲームオブジェクトのタグ
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameオブジェクト名

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.
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします

Operator

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