Keep Event Listeners Across Scene Loads
A persistent audio service needs to hear the level-start event after each scene change. Keep the service GameObject alive, give each level the same event asset, and register the service as a persistent listener. Remove its callback when the service shuts down.
Set up a persistent listener
Give each level publisher a reference to the same OnLevelStart event asset and register its database with GameEventManager. This example passes the level name as a string. Raise the event with Raise(levelName) when the new level is ready.
Use DontDestroyOnLoad to keep the service alive, then register its instance method with AddPersistentListener. Attach this component to a root GameObject in the startup scene and assign the event to onLevelStart in the Inspector.
using TinyGiants.GES.Runtime;
using UnityEngine;
public sealed class LevelAudioService : MonoBehaviour
{
[GameEventDropdown, SerializeField]
private GameEvent<string> onLevelStart;
private void Awake()
{
DontDestroyOnLoad(gameObject);
if (onLevelStart != null)
onLevelStart.AddPersistentListener(HandleLevelStart);
}
private void OnDestroy()
{
if (onLevelStart != null)
onLevelStart.RemovePersistentListener(HandleLevelStart);
}
private void HandleLevelStart(string levelName)
{
Debug.Log($"Select music for {levelName}", this);
}
}
Create the audio service once at startup so each level load uses the same instance. If the service should respond only while enabled, pair registration in OnEnable with removal in OnDisable.
Keep configured scene callbacks
If a persistent object already has an Event Action in Game Event Behavior, enable Persistent Event under Schedule Configuration to retain the event's bindings across scene changes. The callback target must also survive the scene change.

Persistent Event controls the event's scene-change behavior. AddPersistentListener registers one script callback separately, which is useful when an audio service needs to retain only its own subscription.
For scene-local UI, a typed Receiver registers its callback in OnEnable and removes it in OnDisable. A Receiver in the next scene can handle new raises once enabled.
Verify scene changes in the demo
Open 09 Persistent Event and locate the persistent receiver and the two events used in the comparison.

Find both events in Game Event Editor, open their Behavior, and inspect the Persistent Event setting.

- Enter Play Mode and raise both events before switching scenes. Confirm that both callbacks run.
- Switch to the other demo scene and raise both events again. Check which binding the persistent receiver retained.
- To test the audio service in your project, raise the same
OnLevelStartasset from the new level and confirm it receives the new level name. Destroy the service and raise the event once more to verify removal.
Manage databases by scene
Keep audio and save events in a core database. Combat and UI can use their own databases. Register the required databases in Game Event Manager and check their active state.

Use RegisterDatabase, SetDatabaseActive, or UnregisterDatabase if your scene loader needs to manage the manager's bindings dynamically. The listener object still owns callback registration and removal.
