logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class GameModeMusicBinderComponent

    No-code binder that plays music (or fires any other signal) when the game mode changes.
    For each GameMode a designer assigns a Signal Definition asset (typically a PlayMusicTrack signal authored with the Signal Definition inspector); when the game enters that mode, the binder dispatches it. This is the no-code realization of "different music per game mode" — previously it required a code-defined EventDispatcherAction<GameModeChangedSignal>.

    Inheritance
    object
    GameModeMusicBinderComponent
    Namespace: Serenity.GameMode.Infrastructure.Components
    Assembly: Serenity.UnityGameMode.Infrastructure.dll
    Syntax
    public class GameModeMusicBinderComponent : MonoBehaviour
    Remarks

    The binder subscribes to GameModeChangedSignal on the shared IEventDispatcherService (resolved via ServiceLocatorBridge) and dispatches the entered mode's Signal Definition through the same Dispatch(IEventDispatcherSignalDefinition) path SignalEmitterComponent uses — so it builds no signal payload itself and works for any signal type, not just music. The signal asset is held as a UnityEngine.ScriptableObject and cast to IEventDispatcherSignalDefinition, which keeps this component free of any extra assembly dependency. It waits for the dispatcher to be registered before binding and unsubscribes cleanly when disabled.

    Intentionally Unity-only: a scene-authored no-code binder (MonoBehaviour + inspector list of UnityEngine.ScriptableObject signal assets + UnityEngine.Coroutine bind-wait). The Business contract is already GameModeChangedSignal on IEventDispatcherService; this component is just a designer-facing wiring convenience over that signal, conceptually re-authored per engine (e.g. another engine's autoload connecting to the same signal).

    Constructors

    GameModeMusicBinderComponent()

    Declaration
    public GameModeMusicBinderComponent()

    Properties

    Entries

    Gets the configured per-mode signal entries.

    Declaration
    public IReadOnlyList<GameModeMusicBinderComponent.GameModeMusicEntry> Entries { get; }
    Property Value
    Type Description
    IReadOnlyList<GameModeMusicBinderComponent.GameModeMusicEntry>
    In this article
    © 2026 Serenity. All Rights Reserved