Class LightUnitSlider
Formats the provided descriptor into a linear slider with contextual slider markers, tooltips, and icons.
Inherited Members
Namespace: UnityEditor.Rendering
Assembly: Unity.RenderPipelines.Core.Editor.dll
Syntax
public class LightUnitSlider
Constructors
LightUnitSlider(LightUnitSliderUIDescriptor)
Constructor with a LightUnitSliderUIDescriptor
Declaration
public LightUnitSlider(LightUnitSliderUIDescriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
LightUnitSliderUIDescriptor | descriptor |
Fields
m_Descriptor
Declaration
protected readonly LightUnitSliderUIDescriptor m_Descriptor
Field Value
Type | Description |
---|---|
LightUnitSliderUIDescriptor |
m_SerializedObject
The SerializedObject that contains a Light
Declaration
protected SerializedObject m_SerializedObject
Field Value
Type | Description |
---|---|
SerializedObject |
Methods
DoSlider(Rect, ref float, Vector2)
Draws a linear slider mapped to the min/max value range. Override this for different slider behavior (texture background, power).
Declaration
protected virtual void DoSlider(Rect rect, ref float value, Vector2 sliderRange)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The Rect to draw the slider. |
float | value | The current value, and also returns the modified value. |
Vector2 | sliderRange | The ranges of the slider. |
DoSlider(Rect, ref float, Vector2, Vector2)
Draws the slider
Declaration
protected virtual void DoSlider(Rect rect, ref float value, Vector2 sliderRange, Vector2 _)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The Rect to draw the slider. |
float | value | The current value, and also returns the modified value. |
Vector2 | sliderRange | The ranges of the slider. |
Vector2 | _ | Not used |
Draw(Rect, SerializedProperty, ref float)
Draws the slider in a given Rect
Declaration
public virtual void Draw(Rect rect, SerializedProperty value, ref float floatValue)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The Rect to draw the slider into |
SerializedProperty | value | The SerializedProperty with the property serialized |
float | floatValue | The float value modified by the slider GUI |
GetLightUnitTooltip(string, float, string)
Gets the tooltip
Declaration
protected virtual GUIContent GetLightUnitTooltip(string baseTooltip, float value, string unit)
Parameters
Type | Name | Description |
---|---|---|
string | baseTooltip | The base tooltip |
float | value | The value |
string | unit | The units |
Returns
Type | Description |
---|---|
GUIContent | A well formed tooltip on a GUIContent |
GetPositionOnSlider(float)
Maps a light unit value onto the slider. Keeps in sync placement of markers and tooltips with the slider power. Override this in case of non-linear slider.
Declaration
protected virtual float GetPositionOnSlider(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | The value to get the position |
Returns
Type | Description |
---|---|
float | The position on the slider |
GetPositionOnSlider(float, Vector2)
Maps a light unit value onto the slider. Keeps in sync placement of markers and tooltips with the slider power. Override this in case of non-linear slider.
Declaration
protected virtual float GetPositionOnSlider(float value, Vector2 valueRange)
Parameters
Type | Name | Description |
---|---|---|
float | value | The value to get the position at |
Vector2 | valueRange | The ranges of the values |
Returns
Type | Description |
---|---|
float | The position |
SetSerializedObject(SerializedObject)
Modifies the SerializedObject for this Light slider
Declaration
public void SetSerializedObject(SerializedObject serialized)
Parameters
Type | Name | Description |
---|---|---|
SerializedObject | serialized | The SerializedObject representing the serialized data to be used by this slider. |
SetValueToPreset(SerializedProperty, LightUnitSliderUIRange)
The serialized property for color temperature is stored in the build-in light editor, and we need to use this object to apply the update.
Declaration
protected virtual void SetValueToPreset(SerializedProperty value, LightUnitSliderUIRange preset)
Parameters
Type | Name | Description |
---|---|---|
SerializedProperty | value | The value to update |
LightUnitSliderUIRange | preset | The preset range |