How do I play the same background track in every scene?

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

I want to play some music in the background but it stops when I change the scene. How do I continuously play the AudioStreamPlayer in every scene without it starting from different points in the track?

:bust_in_silhouette: Reply From: jgodfrey

The simplest way is probably to play the music from an AutoLoad script, which will survive through scene changes. If you need further guidance to set that up, post back.

Help would be nice. And thanks

Genesis689 | 2022-12-28 19:41

:bust_in_silhouette: Reply From: Gluon

Create a scene which is just an audiostreamplayer with the music you want. You may want to set it too autoplay.

The go into project > project settings. In the tabs you will see autoload. Go to the autoload screen and you can add any node to this, what this will do is automatically load the scene you add whenever you load any other scene, so it is the equivalent of adding it to each scene you load in the game. This should mean that your music will keep playing between scenes.

Thanks this is very helpful.

Genesis689 | 2022-12-29 13:31