Persistant Music Manager playing Start Menu clip on Level 1

Having a slight issue with the Glitch Garden project for Unity2d couse. I’ve created a music manager with an array for each scenes music , it persists using a singleton. My issue is that when I go from the start screen to level 1 … the music keeps playing from the start menu and does not stop. Any Thoughts?

https://pastebin.com/cjxCW5xE

Hi @TronLive

FYI your MusicManager isn’t a Singleton, it’s just using DontDestroyOnLoad. Might be worth revising the course content on Singletons.

With the playing error, try calling Stop() on the audiosource before you start the new clip when you change level. https://docs.unity3d.com/ScriptReference/AudioSource.html

Remember Ben’s code is up on GitHub too if you want to compare yours to his.

Privacy & Terms