Light

Struct Light 

Source
pub struct Light {
Show 31 fields pub m_Color: ColorRGBA, pub m_Cookie: PPtr, pub m_CookieSize: f32, pub m_CullingMask: BitField, pub m_DrawHalo: bool, pub m_Enabled: u8, pub m_Flare: PPtr, pub m_GameObject: PPtr, pub m_Intensity: f32, pub m_Lightmapping: i32, pub m_Range: f32, pub m_RenderMode: i32, pub m_Shadows: ShadowSettings, pub m_SpotAngle: f32, pub m_Type: i32, pub m_ActuallyLightmapped: Option<bool>, pub m_AreaSize: Option<Vector2f>, pub m_BakedIndex: Option<i32>, pub m_BakingOutput: Option<LightBakingOutput>, pub m_BounceIntensity: Option<f32>, pub m_BoundingSphereOverride: Option<Vector4f>, pub m_CCT: Option<f32>, pub m_ColorTemperature: Option<f32>, pub m_FalloffTable: Option<FalloffTable>, pub m_InnerSpotAngle: Option<f32>, pub m_LightShadowCasterMode: Option<i32>, pub m_RenderingLayerMask: Option<u32>, pub m_Shape: Option<i32>, pub m_UseBoundingSphereOverride: Option<bool>, pub m_UseColorTemperature: Option<bool>, pub m_UseViewFrustumForShadowCasterCull: Option<bool>,
}
Expand description

Light is a class of the Unity engine since version 3.4.0. Exert from Unity’s scripting documentation: 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:

Fields§

§m_Color: ColorRGBA

The color of the light.

§m_Cookie: PPtr

The cookie texture projected by the light. PPtr<Texture>: (3.4.0 - 2022.3.2f1)

§m_CookieSize: f32

The size of a directional light’s cookie.

§m_CullingMask: BitField

This is used to light certain objects in the Scene selectively.

§m_DrawHalo: bool§m_Enabled: u8

Enabled Behaviours are Updated, disabled Behaviours are not.

§m_Flare: PPtr

The flare asset to use for this light. PPtr<Flare>: (3.4.0 - 2022.3.2f1)

§m_GameObject: PPtr

The game object this component is attached to. A component is always attached to a game object. PPtr<GameObject>: (3.4.0 - 2022.3.2f1)

§m_Intensity: f32

The Intensity of a light is multiplied with the Light color.

§m_Lightmapping: i32§m_Range: f32

The range of the light.

§m_RenderMode: i32

How to render the light.

§m_Shadows: ShadowSettings

How this light casts shadows

§m_SpotAngle: f32

The angle of the light’s spotlight cone in degrees.

§m_Type: i32

The type of the light.

§m_ActuallyLightmapped: Option<bool>

bool: (3.4.0 - 5.3.8f2)

§m_AreaSize: Option<Vector2f>

The size of the area light (Editor only). Vector2f: (5.4.0f3 - 2022.3.2f1)

§m_BakedIndex: Option<i32>

i32: (5.4.0f3 - 5.6.0b1)

§m_BakingOutput: Option<LightBakingOutput>

This property describes the output of the last Global Illumination bake. LightBakingOutput: (5.6.0f1 - 2022.3.2f1)

§m_BounceIntensity: Option<f32>

The multiplier that defines the strength of the bounce lighting. f32: (5.0.0f4 - 2022.3.2f1)

§m_BoundingSphereOverride: Option<Vector4f>

Bounding sphere used to override the regular light bounding sphere during culling. Vector4f: (2019.1.0f2 - 2022.3.2f1)

§m_CCT: Option<f32>

f32: (5.6.0b1 - 5.6.0b9)

§m_ColorTemperature: Option<f32>

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. f32: (5.6.0f1 - 2022.3.2f1)

§m_FalloffTable: Option<FalloffTable>

FalloffTable: (2017.1.0b1 - 2017.1.0b10)

§m_InnerSpotAngle: Option<f32>

The angle of the light’s spotlight inner cone in degrees. f32: (2019.1.0b1 - 2022.3.2f1)

§m_LightShadowCasterMode: Option<i32>

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. i32: (2018.2.0b1 - 2022.3.2f1)

§m_RenderingLayerMask: Option<u32>

Determines which rendering LayerMask this Light affects. u32: (2019.1.0f2 - 2022.3.2f1)

§m_Shape: Option<i32>

This property describes the shape of the spot light. Only Scriptable Render Pipelines use this property; the built-in renderer does not support it. i32: (2019.3.0b1 - 2022.3.2f1)

§m_UseBoundingSphereOverride: Option<bool>

Set to true to override light bounding sphere for culling. bool: (2019.1.0f2 - 2022.3.2f1)

§m_UseColorTemperature: Option<bool>

Set to true to use the color temperature. bool: (5.6.0f1 - 2022.3.2f1)

§m_UseViewFrustumForShadowCasterCull: Option<bool>

Whether to cull shadows for this Light when the Light is outside of the view frustum. bool: (2020.2.0b1 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for Light

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Light

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Light

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Light

§

impl RefUnwindSafe for Light

§

impl Send for Light

§

impl Sync for Light

§

impl Unpin for Light

§

impl UnwindSafe for Light

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,