Forum rules - please read before posting.

Feature suggestion: Playing music across scenes


I have a gameobject with an audio source attached that I want to keep playing across scenes, for which I use the custom script below. The code is very simple, I only need it for this one piece of music, but I noticed that when I apply the script to one of AC's sound objects it doesn't work anymore, presumably because AC cleans up the objects with the sound script attached to them during a scene change? It's not really a problem in this instance, the other way works fine for me, but maybe this functionality would be nice to integrate into AC's Play Sound action so it can be used during cutscenes and such.

The script source (DontDestroy.cs):

public class DontDestroy : MonoBehaviour {
public static DontDestroy Instance {get;set;}
public bool playOnAwake;
void Awake() {
if (Instance == null) {
Instance = this;
if (playOnAwake)
} else {
public void Play() {
if (audio.clip == null)



  • I'd really love to have seamless music across scenes as well!
  • Yes, I could see this being useful.  It may require you to have a "global" music prefab, however, so when implemented it may need a bit of game-updating on your part.  Should be worth it though, thanks for the suggestion.  And yes - the Sound script basically overrides the default volume level to be in keeping with that set in the Options menu.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.