Class UnityUiToggleComponentFactory
Factory for creating Unity UI toggle components with automatic Unity Toggle component configuration.
Handles instantiation, initialization, and setup of toggle controls including value setting and event listener configuration.
Provides specialized handling for Unity Toggle components with proper event state management during initialization.
Implements
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Components.Factories
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityUiToggleComponentFactory : IUiComponentFactory
Constructors
UnityUiToggleComponentFactory(UnityViewElementFactory)
Initializes the toggle component factory with Unity view element factory dependency.
Sets up the factory with the required view element creation capabilities for toggle component instantiation.
Declaration
public UnityUiToggleComponentFactory(UnityViewElementFactory unityViewElementFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityViewElementFactory | unityViewElementFactory | Factory for creating Unity view elements |
Methods
CreateUiComponent<Element, Parameters, Actions>(Parameters, Actions, IFoundationViewElement, ILogService)
Creates and configures a Unity UI toggle component from template with full initialization.
Instantiates the toggle component GameObject, applies parameters and actions, and performs specialized toggle setup including Unity Toggle component configuration.
Handles Unity-specific toggle initialization with proper event management and initial value setting.
Declaration
public Element CreateUiComponent<Element, Parameters, Actions>(Parameters parameters, Actions actions, IFoundationViewElement template, ILogService logService) where Element : IFoundationViewElement where Parameters : IUiComponentParameters where Actions : IUiComponentActions
Parameters
| Type | Name | Description |
|---|---|---|
| Parameters | parameters | Configuration parameters for the toggle component |
| Actions | actions | Action handlers for toggle component interactions |
| IFoundationViewElement | template | Template foundation view element for component instantiation |
| ILogService | logService | Logging service for error reporting and debugging |
Returns
| Type | Description |
|---|---|
| Element | Fully configured Unity UI toggle component ready for use |
Type Parameters
| Name | Description |
|---|---|
| Element | The target UI component element type |
| Parameters | The component parameters type |
| Actions | The component actions type |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown when component type is unsupported, template is null, or GameObject creation fails |
| InvalidOperationException | Thrown when the required component type cannot be retrieved from the created GameObject |