0 votes

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?

in Engine by (34 points)

2 Answers

0 votes

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.

by (19,278 points)

Help would be nice. And thanks

0 votes

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.

by (3,321 points)

Thanks this is very helpful.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.