Class UnityPrimaryDeviceSelector
Component that waits for the first input from any unpaired device to select the "Primary Device" for Player 1.
Implements
Namespace: Serenity.InputGateway.Infrastructure.Components
Assembly: Serenity.UnityPlayerInput.Infrastructure.dll
Syntax
public class UnityPrimaryDeviceSelector : MonoBehaviour, IPrimaryDeviceSelector
Constructors
UnityPrimaryDeviceSelector()
Declaration
public UnityPrimaryDeviceSelector()
Methods
AwaitAsync(CancellationToken)
Awaits any device to press a button and assigns it as the primary device (P1). Returns scheme, deviceId and displayName.
Declaration
public Task<(string scheme, string deviceId, string displayName)> AwaitAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Cancellation token to abort the await operation. |
Returns
| Type | Description |
|---|---|
| Task<(string scheme, string deviceId, string displayName)> | Tuple with (scheme, deviceId, displayName) of the selected device. |
Initialize(object, ILogService)
Initializes the primary device selector with a PlayerInput component and logging service.
Declaration
public void Initialize(object playerInputHandler, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| object | playerInputHandler | The PlayerInput component to use for device selection. |
| ILogService | logService | The logging service for diagnostic output. |