logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    UnityGamepadTargetResolver
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    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 Gamepad.current. Null is allowed (falls back to Gamepad.current).

    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.

    In this article
    © 2026 Serenity. All Rights Reserved