Class UnityPlayerInputActionBinding
Unity-specific implementation of player input action bindings.
Manages the relationship between Unity InputActions and their callback handlers, providing safe binding/unbinding operations.
Implements the domain interface to abstract Unity Input System details from the business logic layer.
Implements
Inherited Members
Namespace: Serenity.InputGateway.Infrastructure.Entities
Assembly: Serenity.UnityPlayerInput.Infrastructure.dll
Syntax
public class UnityPlayerInputActionBinding : IPlayerInputActionBinding<InputAction, InputAction.CallbackContext>
Constructors
UnityPlayerInputActionBinding(InputAction, Action<CallbackContext>)
Initializes a new Unity input action binding.
Creates the connection between an InputAction and its callback handler without activating the binding.
Declaration
public UnityPlayerInputActionBinding(InputAction action, Action<InputAction.CallbackContext> handler)
Parameters
| Type | Name | Description |
|---|---|---|
| InputAction | action | The Unity InputAction to bind |
| Action<InputAction.CallbackContext> | handler | The callback handler to invoke when the action is performed |
Properties
Handler
Gets the callback handler that will be invoked when the input action is performed.
Receives the CallbackContext containing input event details.
Declaration
public Action<InputAction.CallbackContext> Handler { get; }
Property Value
| Type | Description |
|---|---|
| Action<InputAction.CallbackContext> | Action delegate for handling input events |
InputAction
Gets the Unity InputAction associated with this binding.
Represents the input trigger that will invoke the handler when performed.
Declaration
public InputAction InputAction { get; }
Property Value
| Type | Description |
|---|---|
| InputAction | InputAction instance |
Methods
Bind()
Activates the input binding by subscribing the handler to the InputAction's performed event.
After calling this method, the handler will be invoked whenever the InputAction is triggered.
Declaration
public void Bind()
Unbind()
Deactivates the input binding by unsubscribing the handler from the InputAction's performed event.
After calling this method, the handler will no longer be invoked when the InputAction is triggered.
Declaration
public void Unbind()