How to fade out music while loading next scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By aidave

Is it possible to have a Tween change volume of music in an AudioStream while a new scene is loading?

Because the new scene loading makes the fade Tween not process. The music keeps playing, just not reducing volume. I’d like to fade out the music, then fade in new music after the new scene loads, but I can only either wait until music fades out, then load, or load then wait till music fades out. Either one isn’t the wanted behavior…

Do we have to use a thread?

If so, how can we thread a tween of fading audio?

Seems like an ideal case for an auto-load scene or adding an audio ‘manager’ as a child of root so that its lifetime lives beyond the current scene. Fire an event (e.g. scene changed) so the singleton can adjust its audio. Likewise, an event can indicate when a level is loaded (perhaps even changing the audio stream). The manager controls fading.

There’s still some timing but it’ll probably feel nicer.

spaceyjase | 2023-05-16 11:35