logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Namespace Serenity.Feedback.Infrastructure.Channels

    Classes

    AdaptiveTriggerChannel

    Feedback channel that routes DualSense adaptive-trigger effects to a pluggable backend. Handles AdaptiveTriggerEffect. The default backend is NullAdaptiveTriggerBackend (no-op) until a real PS5-SDK or PC-HID backend is registered. This channel contains NO direct HID/SDK code; all actuation is in the backend.

    AudioChannel

    Feedback channel that plays a sound from an AudioEffect by routing it to the audio player system. Target-agnostic (audio is global, not per-pad). The service dispatches audio effects un-gated, so this plays even when controller vibration is disabled. Fire-and-forget: short SFX, so Stop(FeedbackTarget)/StopAll() are intentional no-ops — they must NOT stop the whole audio bus when the feedback system halts on pause/focus-loss/vibration-disable.

    DecayingJitterMotion

    Reproduces, as a plain enumerable, the decaying-jitter shake math shared verbatim by ScreenShakeChannel and UiScreenShakeChannel: a direction re-rolled every 1/frequency seconds, and a magnitude that either sustains at full amplitude (persistent) or decays linearly to zero over the duration. Extracted so the decay math is assertable without a coroutine/Unity frame loop — see DecayingJitterMotionTests.

    FeedbackBackendDispatcher

    The "try each registered IGamepadOutputBackend in order, first one that claims the pad wins" loop shared by VibrationChannel and LedChannel. Generic over the per-backend apply delegate so this dispatcher carries no knowledge of vibration vs. LED payloads.

    FeedbackRuntimeExtensions

    Extension over IFeedbackRuntime that encapsulates the "wait the unscaled duration (or one frame when the duration is zero/negative) then invoke a callback" coroutine shared by several channels that auto-stop/auto-reset an effect once its duration elapses. Keyed by the same opaque handle Run(IEnumerator, object) uses, so calling RunAfter(IFeedbackRuntime, float, Action, object) again with the same handle cancels (replaces) the previous wait, matching each channel's existing per-effect / per-device cancellation semantics.

    FeedbackTiming

    Small numeric constants shared, verbatim (same name, same value, same purpose), by more than one feedback channel — extracted so the shared value has one place to change. A constant that merely happens to share a numeric value with one of these but serves a different concept is intentionally NOT folded in here (e.g. HitStopChannel's near-zero Time.timeScale guard also uses 0.0001f, but that is a time-scale threshold, not an effect-duration floor — renaming it to a duration constant would be a misleading merge, not a real deduplication).

    HitStopChannel

    Feedback channel that implements hit-stop: briefly dips UnityEngine.Time.timeScale then restores the prior value. Handles HitStopEffect. Target-agnostic (time scale is global). Guards against fighting the pause system: if the game is paused when Play is called, the effect is skipped. On restore, only resets timeScale if nobody else changed it in the interim.

    LedChannel

    Feedback channel that drives a controller's LED: the PlayStation light bar (DualSense / DualShock 4) and the Switch Pro's Home-button ring (monochrome — the color's brightness drives the ring intensity, hue is dropped). Handles LedEffect. Hardware routing goes through the registered IGamepadOutputBackend list; the first backend that claims the pad wins, otherwise a DualShock light bar is driven through Unity's built-in API. Devices with no controllable LED are no-ops. LED output is a desktop/editor-only feature — on other platforms actuation is skipped.

    ScreenFlashChannel

    Feedback channel that produces a full-screen color flash via a lazily-created overlay. Handles ScreenFlashEffect. Target-agnostic (one overlay drives all players). Runs on unscaled time so the flash is visible even during a hit-stop.

    ScreenShakeChannel

    Feedback channel that produces camera positional shake via a decaying jitter coroutine. Handles ScreenShakeEffect. When the target names a joined player and GetPlayerAssignments() has an assignment for it, only that player's camera shakes; when the target is global and split-screen assignments exist, every assigned camera shakes together; otherwise the channel falls back to GetActiveCamera(), which already falls back to UnityEngine.Camera.main when nothing else is registered/selected — call SetActiveCameraOverride(object) to pin a custom rig instead of a plain "MainCamera" tag. The offset is applied through a UnityCameraShakeApplier (added to each camera automatically) so it survives a camera controller that sets the camera's position every frame. Uses unscaled time so it survives a hit-stop. UI shake lives in its own channel (UiScreenShakeChannel).

    UiScreenShakeChannel

    Feedback channel that shakes the UI (menus, HUD) via a decaying jitter coroutine. Handles UiScreenShakeEffect. The screen-space counterpart to ScreenShakeChannel, which shakes the camera. Drives every active UnityUiShakeReceiver through the UiShakeRegistry, and auto-attaches a receiver to each live root Canvas (throttled) so the shake follows the UI across scene/mode changes with no manual setup. Uses unscaled time so it survives a hit-stop.

    VibrationChannel

    Feedback channel that drives gamepad vibration motors. Handles VibrationEffect. Owns its own duration auto-stop: motors are set on Play and cleared after the effect duration via the shared IFeedbackRuntime (realtime, so a paused game still stops the buzz). Hardware routing goes through the registered IGamepadOutputBackend list (DualShock 4 / DualSense / Switch Pro and any future controller); the first backend that claims the pad wins, otherwise the standard Unity motor API is used. The service's global StopAll funnels into StopAll().

    Structs

    JitterSample

    One sampled step of a decaying-jitter shake: a direction and the magnitude to apply along it.

    In this article
    © 2026 Serenity. All Rights Reserved