How to make audio play over a certain amount of scenes

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

Hey,

I am trying to make the audio play over a certain amount of scenes. Like I want it to play on scene 1 and when the game loads into a scene 2, the I wish the audio to continue to play, but from where the audio left off on scene 1, but when scene 3 is loaded then I don’t want the audio to play at all.

Thanks in advance and any help appreciated.

:bust_in_silhouette: Reply From: avencherus

You’ll want to use something like an Autoload singleton. Singletons (AutoLoad) — Godot Engine (3.0) documentation in English

It may be some TSCN that has your audio nodes on it, and can serve as an audio manager for your game. It will persist while the game is up, and using this method you will have a globally accessible name for it.

AudioManager.play_music()

You can also manually add / remove your own Nodes or Scenes to the tree by attaching them to the root.

get_tree().root.add_child(my_node)