Class LightRandomizerTag
Supports the ability to randomize the light state (on/off), intensity (in the unit specified in the Light component), temperature (if using color temperature), and color.
Inherited Members
Namespace: UnityEngine.Perception.Randomization.Randomizers
Assembly: Unity.Perception.Runtime.dll
Syntax
[AddComponentMenu("Perception/RandomizerTags/Light Randomizer Tag")]
[MovedFrom("UnityEngine.Perception.Internal")]
public class LightRandomizerTag : RandomizerTag
Fields
color
Values for each channel (range: 0 to 1) will be sampled based on the chosen Sampling method under Value and set as the Light component's color/filter. When using the Filter and Temperate mode for Light Appearance (under Emission for HDRP lights only), filter will be changed. Otherwise, color will be changed.
Declaration
[Tooltip("Values for each channel (range: 0 to 1) will be sampled based on the chosen Sampling method under Value and set as the Light component's color/filter. When using the Filter and Temperate mode for Light Appearance (under Emission for HDRP lights only), filter will be changed. Otherwise, color will be changed.")]
public ColorRgbParameter color
Field Value
Type | Description |
---|---|
ColorRgbParameter |
colorList
Randomly chooses a color from the options provided and assigns it to the Light component based on the Light Appearance mode set for the component (under Emission for HDRP lights only). If the Filter and Temperature mode is used, the selected color will be applied as a filter to the light. Otherwise if the Color mode is used, the selected color will used as the light's emission color. The probability of each color being selected can be modified by disabling the Uniform flag and providing probability values manually.
Declaration
[Tooltip("Randomly chooses a color from the options provided, if there exists any, and assigns it to the Light component based on the Light Appearance mode set for the component (under Emission for HDRP lights only). If the Filter and Temperature mode is used, the selected color will be applied as a filter to the light. Otherwise if the Color mode is used, the selected color will used as the light's emission color. The probability of each color being selected can be modified by disabling the Uniform flag and providing probability values manually.")]
public CategoricalParameter<Color> colorList
Field Value
Type | Description |
---|---|
CategoricalParameter<Color> |
Remarks
If no colors are provided, the light color will remain unchanged.
intensity
A value will be sampled based on the chosen Sampling method under Value and set as the Light component's Intensity. The unit for intensity will be the same as the one set under Emission in the Light component.
Declaration
[Tooltip("A value will be sampled based on the chosen Sampling method under Value. The unit for intensity will be the same as the one set under Emission. ")]
public FloatParameter intensity
Field Value
Type | Description |
---|---|
FloatParameter |
intensityList
Randomly chooses an intensity from the options provided and assigns it to the Light component in the unit specified under Emission. The probability of each color being selected can be modified by disabling the Uniform flag and providing probability values manually.
Declaration
[Tooltip("Randomly chooses an intensity from the options provided and assigns it to the Light component in the unit specified under Emission. The probability of each color being selected can be modified by disabling the `Uniform flag and providing probability values manually.")]
public CategoricalParameter<float> intensityList
Field Value
Type | Description |
---|---|
CategoricalParameter<float> |
Remarks
If no values are provided, the light intensity will remain unchanged.
specifyColorAsList
When set to true, colorList will be sampled to set the color/filter of the Light component. When set to false, color will be used instead.
Declaration
[Tooltip("When set to true, values for color will be sampled from a list of values. When false, a range of values will be used instead.")]
public bool specifyColorAsList
Field Value
Type | Description |
---|---|
bool |
specifyIntensityAsList
When set to true, intensityList will be sampled to set the intensity of the Light component. When set to false, intensity will be used instead.
Declaration
[Tooltip("When set to true, values for intensity will be sampled from a list of values. When false, a range of values will be used instead.")]
public bool specifyIntensityAsList
Field Value
Type | Description |
---|---|
bool |
specifyTemperatureAsList
When set to true, temperatureList will be sampled to set the temperature of the Light component. When set to false, temperature will be used instead.
Declaration
[Tooltip("When set to true, values for temperature will be sampled from a list of values. When false, a range of values will be used instead.")]
public bool specifyTemperatureAsList
Field Value
Type | Description |
---|---|
bool |
state
A value between 0 and 1 will be randomly chosen. If that value is above the threshold, it will return true. Else it will return false.
Declaration
[Tooltip("The probability for the light to be off. At a threshold (probability) of 0, the light will always be on; at 1, always off and at 0.4, on about 60% of the time.")]
public BooleanParameter state
Field Value
Type | Description |
---|---|
BooleanParameter |
Remarks
At 0, light will always be enabled; At 1, always disabled; At 0.5, enabled half the time.
temperature
A value will be sampled based on the chosen Sampling method under Value and set as the Light component's Temperature. Only utilized when using the Filter and Temperate mode for Light Appearance (under Emission for HDRP lights only).
Declaration
[Tooltip("A value will be sampled based on the chosen Sampling method under Value and set as the Light component's Temperature. This is only utilized when using the Filter and Temperate mode for Light Appearance (under Emission for HDRP lights only).")]
public FloatParameter temperature
Field Value
Type | Description |
---|---|
FloatParameter |
temperatureList
Randomly chooses a temperature from the options provided and assigns it to the Light component if the Light Appearance mode (under Emission) is set to Filter and Temperature (HDRP only). The probability of each color being selected can be modified by disabling the Uniform flag and providing probability values manually.
Declaration
[Tooltip("Randomly chooses a temperature from the options provided and assigns it to the Light component if the Light Appearance mode (under Emission) is set to Filter and Temperature (HDRP only). The probability of each color being selected can be modified by disabling the Uniform flag and providing probability values manually.")]
public CategoricalParameter<float> temperatureList
Field Value
Type | Description |
---|---|
CategoricalParameter<float> |
Remarks
If no values are provided, the light temperature will remain unchanged.
Methods
Randomize()
Based on the configuration of the LightRandomizerTag, randomize state, intensity, temperature, and color of the Light component.
Declaration
public void Randomize()