Class UnityGamepadTargetResolver
Resolves a FeedbackTarget or a PlayerInput object to a Unity UnityEngine.InputSystem.Gamepad. Returns null when a gamepad cannot be resolved; callers are expected to no-op on null.
Inherited Members
Namespace: Serenity.Feedback.Infrastructure.Services
Assembly: Serenity.UnityFeedback.Infrastructure.dll
Syntax
public class UnityGamepadTargetResolver
Constructors
UnityGamepadTargetResolver(IActingDeviceTracker)
Initializes the resolver.
Declaration
public UnityGamepadTargetResolver(IActingDeviceTracker actingDeviceTracker = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IActingDeviceTracker | actingDeviceTracker | Optional tracker of the device that last drove a UI action;
when present it is used to resolve the acting pad instead of the ambiguous
|
Methods
GetDeviceKey(Gamepad)
Returns a stable string key identifying the device for coroutine tracking.
Declaration
public string GetDeviceKey(Gamepad gamepad)
Parameters
| Type | Name | Description |
|---|---|---|
| Gamepad | gamepad | The resolved gamepad. |
Returns
| Type | Description |
|---|---|
| string | The device id as string, or null when gamepad is null. |
Resolve(FeedbackTarget)
Resolves a FeedbackTarget to a UnityEngine.InputSystem.Gamepad. Priority order: UseActingPad -> PlayerIndex -> DeviceId.
Declaration
public Gamepad Resolve(FeedbackTarget target)
Parameters
| Type | Name | Description |
|---|---|---|
| FeedbackTarget | target | The feedback target descriptor. |
Returns
| Type | Description |
|---|---|
| Gamepad | Resolved gamepad, or null when no matching device is found. |
ResolveFromPlayerInput(object)
Resolves a UnityEngine.InputSystem.PlayerInput object to its first UnityEngine.InputSystem.Gamepad.
Accepts the object as object to avoid a hard reference in the Application layer.
Declaration
public Gamepad ResolveFromPlayerInput(object playerInputObj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | playerInputObj | A UnityEngine.InputSystem.PlayerInput instance passed as object. |
Returns
| Type | Description |
|---|---|
| Gamepad | First gamepad found in the player's devices, or null. |