+1 vote

I want to use my music audio to continue playing when entering level (scenes).
I want to command my music audio to stop playing like
Play("Level1") to Stop("Level5")
i know how to use AudioStreamPlayer but i don't know how to code/commands it.
What code/commands should i use?

in Engine by (13 points)

1 Answer

+3 votes

You can create a singleton scene called Sound.tscn which contains all your AudioStreamPlayers. A singleton is a scene that is always present as a node of your game, regardless of whatever other nodes you load.

You can specify a scene as a singleton in your Project Settings.

Once you have the singleton, elsewhere in your code you can make calls like this:


You can also create custom functions in a script on your Sound node which fade the music in and out, as well as transition between tracks.

by (1,604 points)
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.