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>.
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.
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> |