Is it possible to have an autoload play only on a couple of scenes of my game.

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

Created a scene with an audioplayer2D attached to it. I currently have this scene autoloading, but I only want the music to play on certain scenes. On these certain scenes, I also want the music to continue where it left off on the previous scene.

:bust_in_silhouette: Reply From: Zylann

I would suggest you pause your player in the code that makes you transition from a scene to another, if you know that it should not play in the next scene. Or make that next scene stop the player from its main script (or with a component script).
With player.stop().

Then resume the player when the next scene should have music where it left from. Or have those scenes query the player, and call resume on it if it’s not playing.
Which I assume is (never tried this, there was another question about pausing and resuming here