Class UnityMenuController
Unity-specific implementation of UnityUiController for menu navigation and input handling.
Manages player input processing, menu navigation, and interaction with the Unity menu service.
Namespace: Serenity.Menu.Infrastructure.Controllers
Assembly: Serenity.UnityMenu.Infrastructure.dll
Syntax
public class UnityMenuController : UnityUiController
Constructors
UnityMenuController()
Declaration
public UnityMenuController()
Methods
Cancel()
Processes the cancel action for the currently active menu view.
Invokes the cancel behavior on the active menu view if the controller is enabled and initialized.
Declaration
public override void Cancel()
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown if the controller is not initialized. |
Initialize(string, string, float, int, float, IPlayerInputService, IPlayerInputActionBindingFactory<InputAction, CallbackContext>, IMenuService, IComponent, object, ILogService)
Initializes the Unity menu controller with required dependencies and configuration.
Sets up input handling, timing controls, and integrates with the menu service.
Declaration
public void Initialize(string id, string guid, float changeInterval, int consecutiveChangesBeforeSpeedUp, float fastChangeInterval, IPlayerInputService playerInputService, IPlayerInputActionBindingFactory<InputAction, InputAction.CallbackContext> playerInputActionBindingFactory, IMenuService menuService, IComponent timer, object playerInput, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Unique identifier for this controller instance. |
| string | guid | Globally unique identifier for this controller. |
| float | changeInterval | Base interval between navigation changes. |
| int | consecutiveChangesBeforeSpeedUp | Number of changes before enabling speed up. |
| float | fastChangeInterval | Faster interval for rapid navigation. |
| IPlayerInputService | playerInputService | Service for handling player input. |
| IPlayerInputActionBindingFactory<InputAction, CallbackContext> | playerInputActionBindingFactory | Factory for creating input action bindings. |
| IMenuService | menuService | Menu service for managing menu operations. |
| IComponent | timer | Timer component for managing input timing. |
| object | playerInput | Player input configuration object. |
| ILogService | logService | Logging service for diagnostics. |
Navigate(Vector3)
Handles directional navigation input for menu option selection.
Processes vertical direction input to update the selected menu option and restarts hold direction timing.
Declaration
public override void Navigate(Vector3 direction)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | direction | 3D direction vector indicating navigation input (Y component used for vertical navigation). |
Submit()
Processes the submit action for the currently selected menu option.
Invokes the submit behavior on the active menu view if the controller is enabled and initialized.
Declaration
public override void Submit()
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown if the controller is not initialized. |
UpdateSelectedOption(int)
Updates the currently selected menu option based on navigation input.
Selects the next or previous option in the active menu view depending on the input direction.
Declaration
protected void UpdateSelectedOption(int shiftIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shiftIndex | Integer indicating navigation direction: negative for next, positive for previous. |
UpdateSelectedOptionValue(int)
Updates the value of the currently selected menu option if it is interactable.
Increments or decrements the option's value based on horizontal navigation input.
Declaration
protected void UpdateSelectedOptionValue(int shiftIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shiftIndex | Integer indicating value change direction: positive to increment, negative to decrement. |