Class LightUnitSlider
Formats the provided descriptor into a linear slider with contextual slider markers, tooltips, and icons.
Inherited Members
Namespace: UnityEditor.Rendering
Syntax
public class LightUnitSliderConstructors
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_DescriptorField Value
| Type | Description | 
|---|---|
| LightUnitSliderUIDescriptor | 
m_SerializedObject
The SerializedObject that contains a Light
Declaration
protected SerializedObject m_SerializedObjectField Value
| Type | Description | 
|---|---|
| SerializedObject | 
Methods
DoSlider(Rect, ref Single, 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. | 
| Single | value | The current value, and also returns the modified value. | 
| Vector2 | sliderRange | The ranges of the slider. | 
DoSlider(Rect, ref Single, 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. | 
| Single | value | The current value, and also returns the modified value. | 
| Vector2 | sliderRange | The ranges of the slider. | 
| Vector2 | _ | Not used | 
Draw(Rect, SerializedProperty, ref Single)
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 | 
| Single | floatValue | The float value modified by the slider GUI | 
GetLightUnitTooltip(String, Single, String)
Gets the tooltip
Declaration
protected virtual GUIContent GetLightUnitTooltip(string baseTooltip, float value, string unit)Parameters
| Type | Name | Description | 
|---|---|---|
| String | baseTooltip | The base tooltip | 
| Single | value | The value | 
| String | unit | The units | 
Returns
| Type | Description | 
|---|---|
| GUIContent | A well formed tooltip on a GUIContent | 
GetPositionOnSlider(Single)
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 | 
|---|---|---|
| Single | value | The value to get the position | 
Returns
| Type | Description | 
|---|---|
| Single | The position on the slider | 
GetPositionOnSlider(Single, 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 | 
|---|---|---|
| Single | value | The value to get the position at | 
| Vector2 | valueRange | The ranges of the values | 
Returns
| Type | Description | 
|---|---|
| Single | The position | 
SetSerializedObject(SerializedObject)
Modifies the SerializedObject for this Light slider
Declaration
public void SetSerializedObject(SerializedObject serialized)Parameters
| Type | Name | Description | 
|---|---|---|
| SerializedObject | serialized | 
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 |