Class Light2D
Class Light2D
is a 2D light which can be used with the 2D Renderer.
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Syntax
[ExecuteAlways]
[DisallowMultipleComponent]
[MovedFrom("UnityEngine.Experimental.Rendering.Universal")]
[AddComponentMenu("Rendering/2D/Light 2D")]
[HelpURL("https://docs.unity.cn/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/2DLightProperties.html")]
public sealed class Light2D : Light2DBase, ISerializationCallbackReceiver
Properties
blendStyleIndex
The lights current operation index
Declaration
public int blendStyleIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
color
The lights current color
Declaration
public Color color { get; set; }
Property Value
Type | Description |
---|---|
Color |
falloffIntensity
Controls the brightness and distance of the fall off (edge) of the light
Declaration
public float falloffIntensity { get; }
Property Value
Type | Description |
---|---|
Single |
intensity
The lights current intensity
Declaration
public float intensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
lightCookieSprite
The Sprite that's used by the Sprite Light type to control the shape light
Declaration
public Sprite lightCookieSprite { get; }
Property Value
Type | Description |
---|---|
Sprite |
lightOrder
Gets or sets the light order. The lightOrder determines the order in which the lights are rendered onto the light textures.
Declaration
public int lightOrder { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
lightType
The light's current type
Declaration
public Light2D.LightType lightType { get; set; }
Property Value
Type | Description |
---|---|
Light2D.LightType |
normalMapDistance
The simulated z distance of the light from the surface used in normal map calculation.
Declaration
public float normalMapDistance { get; }
Property Value
Type | Description |
---|---|
Single |
normalMapQuality
Returns the calculation quality for the normal map rendering. Please refer to NormalMapQuality.
Declaration
public Light2D.NormalMapQuality normalMapQuality { get; }
Property Value
Type | Description |
---|---|
Light2D.NormalMapQuality |
overlapOperation
Returns the overlap operation mode.
Declaration
public Light2D.OverlapOperation overlapOperation { get; }
Property Value
Type | Description |
---|---|
Light2D.OverlapOperation |
pointLightInnerAngle
The inner angle of the point light shape. The bigger the angle, the wider the gap. The gap between the innner and outer angle will determine the size of the light's penumbra.
Declaration
public float pointLightInnerAngle { get; set; }
Property Value
Type | Description |
---|---|
Single |
pointLightInnerRadius
The radius of the inner light area that has full brightness. The gap between the inner and outer radius will determine the size of the light's penumbra.
Declaration
public float pointLightInnerRadius { get; set; }
Property Value
Type | Description |
---|---|
Single |
pointLightOuterAngle
The angle that determins the shape of the inner light area. The gap between the innner and outer angle will determine the size of the light's penumbra.
Declaration
public float pointLightOuterAngle { get; set; }
Property Value
Type | Description |
---|---|
Single |
pointLightOuterRadius
The outer radius that determines the size of the light. The gap between the inner and outer radius will determine the size of the light's penumbra.
Declaration
public float pointLightOuterRadius { get; set; }
Property Value
Type | Description |
---|---|
Single |
renderVolumetricShadows
Declaration
public bool renderVolumetricShadows { get; }
Property Value
Type | Description |
---|---|
Boolean |
shadowIntensity
Specifies the darkness of the shadow
Declaration
public float shadowIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
shadowsEnabled
Specifies that the shadows are enabled
Declaration
public bool shadowsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
shadowVolumeIntensity
Specifies the darkness of the shadow
Declaration
public float shadowVolumeIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
shapeLightFalloffSize
The size of the fall-off area. Bigger value corresponds to bigger fall off size.
Declaration
public float shapeLightFalloffSize { get; }
Property Value
Type | Description |
---|---|
Single |
shapeLightParametricAngleOffset
The offset of the shape from the light's origin.
Declaration
public float shapeLightParametricAngleOffset { get; }
Property Value
Type | Description |
---|---|
Single |
shapeLightParametricRadius
The size of the shape.
Declaration
public float shapeLightParametricRadius { get; }
Property Value
Type | Description |
---|---|
Single |
shapeLightParametricSides
The number of sides in the parametric shape.
Declaration
public int shapeLightParametricSides { get; }
Property Value
Type | Description |
---|---|
Int32 |
shapePath
Returns the path that represents the shape light. Values are in object space.
Declaration
public Vector3[] shapePath { get; }
Property Value
Type | Description |
---|---|
Vector3[] |
volumeIntensity
Controls the visibility of the light's volume
Declaration
public float volumeIntensity { get; }
Property Value
Type | Description |
---|---|
Single |
volumeIntensityEnabled
Enables or disables the light's volume
Declaration
public bool volumeIntensityEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
volumetricShadowsEnabled
Specifies that the volumetric shadows are enabled
Declaration
public bool volumetricShadowsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
OnAfterDeserialize()
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Declaration
public void OnBeforeSerialize()