logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IGamepadOutputBackend

    A per-controller output backend that drives vibration and/or the LED on a specific gamepad family (DualShock 4, DualSense, Switch Pro, ...) through whatever transport that family needs — Unity's HID ExecuteCommand or a raw OS HID handle. The vibration and LED channels iterate the registered backends in order and take the FIRST that claims the pad, falling back to Unity's built-in API when none do.

    This is the controller-extension seam: supporting a new controller means adding a backend and registering it in the installer — no channel changes (open/closed). It is also where a future transport swap lives (e.g. moving a PlayStation pad off Unity's ExecuteCommand onto raw HID): add a backend that uses the other transport and the channels are unaffected.

    Every method returns false for a pad this backend does not handle (wrong family, unsupported connection, or unsupported platform) so the caller falls through to the next backend or the default path.

    Namespace: Serenity.Feedback.Infrastructure.Services
    Assembly: Serenity.UnityFeedback.Infrastructure.dll
    Syntax
    public interface IGamepadOutputBackend
    Remarks

    Intentionally Unity/HID-local: this is a hardware-protocol strategy over Unity's Input System UnityEngine.InputSystem.Gamepad and raw OS HID handles, rewritten per engine regardless of any Business abstraction. The Business-facing contract is the feedback effect (vibration/LED intensity via IFeedbackChannel), not this transport seam.

    Methods

    TrySetLed(Gamepad, Color)

    Sets the controller LED on pad if this backend handles it. Monochrome LEDs (e.g. the Switch Pro Home ring) derive intensity from the color's brightness. Returns true when handled.

    Declaration
    bool TrySetLed(Gamepad pad, Color color)
    Parameters
    Type Name Description
    Gamepad pad
    Color color
    Returns
    Type Description
    bool

    TrySetVibration(Gamepad, float, float)

    Sets the vibration motors on pad if this backend handles it. Returns true when handled.

    Declaration
    bool TrySetVibration(Gamepad pad, float low, float high)
    Parameters
    Type Name Description
    Gamepad pad
    float low
    float high
    Returns
    Type Description
    bool
    In this article
    © 2026 Serenity. All Rights Reserved