+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?

asked Jul 13, 2018 in Engine by CuteCattyGirl (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.

answered Jul 14, 2018 by Diet Estus (1,504 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 How to use this Q&A? before posting your first questions.