Represents a custom UI component that functions as a toggle control with sliding animation.
Original file from the Unity documentation with only minor compatability modifications made.
More...
Represents a custom UI component that functions as a toggle control with sliding animation.
Original file from the Unity documentation with only minor compatability modifications made.
A UI Toolkit BaseField<bool> with a styled track and knob. It is not derived from System.Boolean and does not implement preference persistence itself. The configured application/editor USS supplies animation and appearance; construction adds classes only. Click and NavigationSubmit toggle value. KeyDown handles Enter/Return/Space outside player panels; player panels rely on NavigationSubmit to avoid double toggling. Use value for ordinary ChangeEvent notification and SetValueWithoutNotify for silent synchronization. Both update the checked class and current portable control styling.
| GWG.Extensions.SlideToggleControl.SlideToggleControl |
( |
| ) |
|
|
inline |
Creates A custom UI control representing a Toggle element with a sliding animation but no Label, designed to manage a boolean value in a visually interactive way.
The control derives from BaseField<bool> and provides a stylizedand interactive interface for enabling or disabling a boolean state. It includes a sliding knob and supports input events such as clicking, KeyValue presses, and navigation-based submissions, offering a user-friendly functionality. The control is styled through specific USS classes which can be customized further.
| GWG.Extensions.SlideToggleControl.SlideToggleControl |
( |
string | label | ) |
|
|
inline |
A custom UI control that visually represents a Toggle element with a sliding animation and Label, It serves as a container for its child control, providing an interactive element for enabling or disabling a boolean value.
This control derives from BaseField<bool> and is stylized to align content in a flexible and user-friendly manner. Users can activate or deactivate the toggle through multiple input methods: clicking, pressing a KeyValue, or submitting navigation input. The control includes custom styling and a knob element to enhance visualization.
- Parameters
-
| label | Optional field caption; null omits a meaningful caption. |
Construction wires field gestures and CSS classes, not preference persistence. Supplied stylesheet controls visual animation; value notifications follow BaseField.