Class UnityPlayerInputInstaller
Unity implementation of the player input installer responsible for setting up the complete input system.
Handles PlayerInput component creation, service configuration, factory registration, and dependency injection.
Manages input routing, UI navigation setup, and validates all configuration settings during installation.
Namespace: Serenity.InputGateway.Installation.Installers
Assembly: Serenity.UnityPlayerInput.Installation.dll
Syntax
public class UnityPlayerInputInstaller : PlayerInputInstaller<InputAction, InputAction.CallbackContext>, IFoundationInstaller, IInstaller
Constructors
UnityPlayerInputInstaller()
Declaration
public UnityPlayerInputInstaller()
Methods
Install(PlayerInputInstallerInstallInput)
Creates the Unity Player Input service by loading settings, validating configuration,
and creating necessary factories and service instances.
Orchestrates the complete installation pipeline including input routing, UI navigation, and component hierarchy setup.
Validates all settings before proceeding with installation to ensure system integrity.
Declaration
public override void Install(PlayerInputInstallerInstallInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerInputInstallerInstallInput | input | Installation input DTO containing settings, context, and configuration data. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown when player input settings are not found or validation fails. |
InstallFactories(PlayerInputInstallerInstallInput)
Installs all required factories for the player input system components.
Creates factories for action bindings, services, PlayerInput components, managers, gates, routers, and slot management.
Ensures all factory dependencies are properly configured before service creation.
Declaration
protected void InstallFactories(PlayerInputInstallerInstallInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerInputInstallerInstallInput | input | Installation input DTO containing context and configuration. |
InstallJoinServiceFactory()
Creates and returns the Unity-specific player input join service factory.
Factory handles creation of join service components for managing player joining behavior.
Declaration
protected override IPlayerInputJoinServiceFactory InstallJoinServiceFactory()
Returns
| Type | Description |
|---|---|
| IPlayerInputJoinServiceFactory | The configured player input join service factory instance. |
InstallPlayerInputActionBindingFactory()
Creates and returns the Unity-specific player input action binding factory.
Factory handles creation of action bindings for input actions and callback contexts.
Declaration
protected override IPlayerInputActionBindingFactory<InputAction, InputAction.CallbackContext> InstallPlayerInputActionBindingFactory()
Returns
| Type | Description |
|---|---|
| IPlayerInputActionBindingFactory<InputAction, CallbackContext> | The configured player input action binding factory instance. |
InstallPlayerInputFactory(object)
Creates and returns the Unity-specific player input factory configured with the provided input action asset.
Factory is responsible for creating PlayerInput components with proper action asset binding.
Declaration
protected override IPlayerInputFactory InstallPlayerInputFactory(object inputActionAsset)
Parameters
| Type | Name | Description |
|---|---|---|
| object | inputActionAsset | The InputActionAsset to configure the factory with. |
Returns
| Type | Description |
|---|---|
| IPlayerInputFactory | The configured player input factory instance. |
InstallPlayerInputManagerFactory()
Creates and returns the Unity-specific player input manager factory.
Factory handles creation of PlayerInputManager components for managing multiple player connections.
Declaration
protected override IPlayerInputManagerFactory InstallPlayerInputManagerFactory()
Returns
| Type | Description |
|---|---|
| IPlayerInputManagerFactory | The configured player input manager factory instance. |
InstallPlayerInputSlotsFactory()
Creates and returns the Unity-specific player input slots factory.
Factory handles creation of player input slots components for managing player device slot assignments.
Declaration
protected override IPlayerInputSlotsFactory InstallPlayerInputSlotsFactory()
Returns
| Type | Description |
|---|---|
| IPlayerInputSlotsFactory | The configured player input slots factory instance. |
InstallPrimaryDeviceSelectorFactory()
Creates and returns the Unity-specific primary device selector factory.
Factory handles creation of primary device selector components for selecting the main input device.
Declaration
protected override IPrimaryDeviceSelectorFactory InstallPrimaryDeviceSelectorFactory()
Returns
| Type | Description |
|---|---|
| IPrimaryDeviceSelectorFactory | The configured primary device selector factory instance. |
InstallPrimaryInputGateFactory()
Creates and returns the Unity-specific primary input gate factory.
Factory handles creation of primary input gate components for managing primary input handling.
Declaration
protected override IPrimaryInputGateFactory InstallPrimaryInputGateFactory()
Returns
| Type | Description |
|---|---|
| IPrimaryInputGateFactory | The configured primary input gate factory instance. |
InstallService(object, IPlayerInputServiceSettingsDefinition, TaskBuildContext, IUiInputRouter, IPlayerInputSlots, IUiInputRouter, IPrimaryDeviceSelector, IPrimaryInputGate, IPlayerInputJoinService)
Creates and returns the Unity-specific player input service instance.
Service is initialized with PlayerInput component, settings, context, and UI input router.
Handles all player input management and routing functionality.
Declaration
protected override IPlayerInputService InstallService(object playerInput, IPlayerInputServiceSettingsDefinition settings, TaskBuildContext context, IUiInputRouter uiInputRouter, IPlayerInputSlots slots, IUiInputRouter inputRouter, IPrimaryDeviceSelector primaryDeviceSelector, IPrimaryInputGate primaryInputGate, IPlayerInputJoinService joinService)
Parameters
| Type | Name | Description |
|---|---|---|
| object | playerInput | The PlayerInput component to associate with the service. |
| IPlayerInputServiceSettingsDefinition | settings | The player input service settings definition. |
| TaskBuildContext | context | The task build context for service initialization. |
| IUiInputRouter | uiInputRouter | The UI input router component for handling UI input routing. |
| IPlayerInputSlots | slots | |
| IUiInputRouter | inputRouter | |
| IPrimaryDeviceSelector | primaryDeviceSelector | |
| IPrimaryInputGate | primaryInputGate | |
| IPlayerInputJoinService | joinService |
Returns
| Type | Description |
|---|---|
| IPlayerInputService | The fully initialized player input service instance. |
InstallServiceFactory()
Creates and returns the Unity-specific player input service factory.
Provides factory for creating service instances with proper initialization and configuration.
Declaration
protected override IPlayerInputServiceFactory InstallServiceFactory()
Returns
| Type | Description |
|---|---|
| IPlayerInputServiceFactory | The configured player input service factory instance. |
InstallUiInputRouterFactory()
Creates and returns the Unity-specific UI input router factory.
Factory handles creation of UI input router components for routing input to UI elements.
Declaration
protected override IUiInputRouterFactory InstallUiInputRouterFactory()
Returns
| Type | Description |
|---|---|
| IUiInputRouterFactory | The configured UI input router factory instance. |