Class UnityUiSelectorComponent
Unity UI selector component that provides option selection functionality with multiple value type support.
Extends the submit component to handle array-based value selection including string, integer, and float types.
Implements IUiSelectable interface for comprehensive option selection and value management within the Unity UI system.
Inheritance
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Components
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityUiSelectorComponent : UnityUiSubmitComponent, IUiInteractable, IUiComponent, IUiSubmittable, IUiSelectable, IComponent, IFoundationSettings
Constructors
UnityUiSelectorComponent()
Initializes a new Unity UI selector component with selector interaction type configuration.
Sets up the component for option selection operations within the UI system.
Declaration
public UnityUiSelectorComponent()
Properties
SelectableActions
Gets or sets the selectable actions interface for option selection event handling.
Manages callbacks for value changes and selectable values configuration updates.
Declaration
public IUiSelectableActions SelectableActions { get; set; }
Property Value
| Type | Description |
|---|---|
| IUiSelectableActions | The selectable actions interface |
SelectableParameters
Gets or sets the selectable parameters interface for option configuration.
Provides access to selectable values array, selected index, and value type settings.
Declaration
public IUiSelectableParameters SelectableParameters { get; set; }
Property Value
| Type | Description |
|---|---|
| IUiSelectableParameters | The selectable parameters interface |
Methods
DecrementValue()
Decrements the selected option index with wraparound functionality.
Moves to the previous option in the array, wrapping to the last option when reaching the beginning.
Calls base decrement functionality for additional UI system integration.
Declaration
public override void DecrementValue()
Overrides
GetSelectedValue()
Retrieves the currently selected value from the selectable values array.
Returns null if the selected index is invalid or outside the array bounds.
Provides safe access to the current selection state for external components.
Declaration
public virtual ConfigurationEntry GetSelectedValue()
Returns
| Type | Description |
|---|---|
| ConfigurationEntry | The currently selected KeyValuePair or null if selection is invalid |
IncrementValue()
Increments the selected option index with wraparound functionality.
Moves to the next option in the array, wrapping to the first option when reaching the end.
Calls base increment functionality for additional UI system integration.
Declaration
public override void IncrementValue()
Overrides
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
SetFloatValue(float)
Sets a float value directly without array indexing for numeric selector types.
Updates the selected value in the array and refreshes the UI display with the new float value.
Triggers value change callbacks for system integration and state management.
Declaration
public virtual void SetFloatValue(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to set directly |
SetIntValue(int)
Sets an integer value directly without array indexing for numeric selector types.
Updates the selected value in the array and refreshes the UI display with the new numeric value.
Triggers value change callbacks for system integration and state management.
Declaration
public virtual void SetIntValue(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The integer value to set directly |
SetSelectableValues(ConfigurationEntry[])
Updates the selectable values array and refreshes the component state.
Validates the array is not empty and adjusts the selected index if necessary.
Triggers selectable values change callbacks and updates the UI display to reflect the new options.
Declaration
public virtual void SetSelectableValues(ConfigurationEntry[] selectableValues)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationEntry[] | selectableValues | The new array of selectable key-value pairs |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when the selectableValues array is empty |
SetValue(int)
Sets the selected option by its index in the selectable values array.
Updates the UI display with localized text and triggers value change callbacks.
Handles empty or null arrays gracefully by clearing the display and resetting the selected index.
Declaration
public virtual void SetValue(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the option to select |
SetValue(string)
Sets the selector value from a string representation with automatic type parsing.
Handles integer and float value types with appropriate parsing and delegates to index-based selection.
Falls back to integer parsing for default behavior when type detection fails.
Declaration
public override void SetValue(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string value to parse and set |