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.
Обычно источник света создается в редакторе, но иногда вам может понадобиться создать источник света через код (из скрипта)
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); } }
areaSize | The size of the area light (Editor only). |
bakingOutput | This property describes the output of the last Global Illumination bake. |
bounceIntensity | The multiplier that defines the strength of the bounce lighting. |
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. Candle light is 1800K. If you want to use lightsUseCCT, lightsUseLinearIntensity has to be enabled to ensure physically correct output. See Also: GraphicsSettings.lightsUseLinearIntensity, GraphicsSettings.lightsUseCCT. |
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. |
layerShadowCullDistances | Per-light, per-layer shadow culling distances. |
lightmapBakeType | This property describes what part of a light's contribution can be baked (Editor only). |
lightShadowCasterMode | Allows 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 | Диапазон(размер) источника света |
renderMode | How to render the light. |
shadowAngle | Controls the amount of artificial softening applied to the edges of shadows cast by directional lights. |
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. |
shadowRadius | Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light. |
shadowResolution | The resolution of the shadow map. |
shadows | Как этот источник света отбрасывает тени |
shadowStrength | Интенсивность теней |
spotAngle | The angle of the light's spotlight cone in degrees. |
type | Тип света. |
AddCommandBuffer | Add a command buffer to be executed at a specified place. |
AddCommandBufferAsync | Adds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point. |
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. |
Reset | Revert all light parameters to default. |
SetLightDirty | Sets a light dirty to notify the light baking backends to update their internal light representation (Editor only). |
enabled | Включенное Поведение обновляется, выключенное Поведение не обновляется. |
isActiveAndEnabled | Has the Behaviour had active and enabled called? |
gameObject | Игровой объект к которому прикреплён данный компонент. Компонент всегда прикреплён к игровому объекту. |
tag | Тег данного игрового объекта. |
transform | The Transform attached to this GameObject. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
name | The name of the object. |
BroadcastMessage | Вызывает метод названный methodName на каждом MonoBehaviour этого game object-а или любого из его потомков. |
CompareTag | Помечен ли данный игровой объект тегом tag? |
GetComponent | Возвращает компонент типа type, если он прикреплен к игровому объекту и null, если не прикреплен. |
GetComponentInChildren | Возвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину. |
GetComponentInParent | Возвращает все компоненты типа type из GameObject'а или из любого его родителя. |
GetComponents | Возвращает все компоненты типа type в GameObject. |
GetComponentsInChildren | Возвращает все компоненты типа type в GameObject или любому из его потомков. |
GetComponentsInParent | Возвращает все компоненты типа type в GameObject или любому из его родителей. |
SendMessage | Вызывает метод с названием methodName в каждом MonoBehaviour в этом игровом объекте. |
SendMessageUpwards | Вызывает метод с именем methodName в каждом MonoBehaviour в этом игровом объекте и в каждом предке поведения. |
GetInstanceID | Returns the instance id of the object. |
ToString | Returns the name of the object. |
Destroy | Removes a GameObject, component or asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
FindObjectOfType | Returns the first active loaded object of Type type. |
FindObjectsOfType | Returns a list of all active loaded objects of Type type. |
Instantiate | Clones the object original and returns the clone. |
bool | Does 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. |