Class UnityUiSliderComponent
Unity UI slider component that provides range-based value selection with configurable bounds and precision.
Supports both integer and float value types with automatic rounding and validation for numeric input within defined ranges.
Implements IUiSlideable interface for comprehensive range control functionality within the Unity UI system.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Components
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityUiSliderComponent : UnityUiInteractableComponent, IUiInteractable, IUiComponent, IUiSlideable, IComponent, IFoundationSettings
Constructors
UnityUiSliderComponent()
Initializes a new Unity UI slider component with slider interaction type configuration.
Sets up the component for range-based value selection operations within the UI system.
Declaration
public UnityUiSliderComponent()
Fields
_slider
Declaration
protected Slider _slider
Field Value
| Type | Description |
|---|---|
| Slider |
Properties
SlideableActions
Gets or sets the slideable actions interface for range value event handling.
Manages callbacks for value changes, minimum value changes, and maximum value changes.
Declaration
public IUiSlideableActions SlideableActions { get; set; }
Property Value
| Type | Description |
|---|---|
| IUiSlideableActions | The slideable actions interface |
SlideableParameters
Gets or sets the slideable parameters interface for range configuration.
Provides access to current value, minimum value, maximum value, and value type settings.
Declaration
public IUiSlideableParameters SlideableParameters { get; set; }
Property Value
| Type | Description |
|---|---|
| IUiSlideableParameters | The slideable parameters interface |
Methods
ChangeMaximumValue(float)
Changes the maximum allowed value for the slider range.
Updates both the parameter storage and the Unity Slider component's maximum value.
Triggers maximum value change callbacks for system integration and state management.
Declaration
public virtual void ChangeMaximumValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The new maximum value for the slider range |
ChangeMinimumValue(float)
Changes the minimum allowed value for the slider range.
Updates both the parameter storage and the Unity Slider component's minimum value.
Triggers minimum value change callbacks for system integration and state management.
Declaration
public virtual void ChangeMinimumValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The new minimum value for the slider range |
OnEnable()
Unity lifecycle method called when the component is enabled.
Calls base initialization for proper component setup and configuration.
Declaration
public override void OnEnable()
Overrides
SetValue(float)
Sets the slider value with type-specific formatting and validation.
Handles integer rounding for INT type and validates value is within the configured range.
Updates both the Unity Slider component and associated text display with proper formatting.
Declaration
public virtual void SetValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to set for the slider |
Exceptions
| Type | Condition |
|---|---|
| NullReferenceException | Thrown when SlideableParameters is null |
| ArgumentOutOfRangeException | Thrown when value is outside the configured range |
| NullReferenceException | Thrown when value GameObject or TMP_Text component is missing |
SetValue(string)
Sets the slider value from a string representation with automatic type parsing.
Converts the string to float and delegates to the float-based SetValue method.
Provides string interface compatibility for the abstract base class requirement.
Declaration
public override void SetValue(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string value to parse and set |
Overrides
SetValueFromSlider()
Declaration
public virtual void SetValueFromSlider()
UpdateTextValue(float)
Declaration
protected void UpdateTextValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value |