I have been stuck on reaching an effective method for creating an instance of game music in the main menu and in the levels. What I hope to achieve is one piece of music playing through the different menu scenes and then another piece of music for the game.
The problem I have is when using 'DontDestroyOnLoad' I get music spawning twice!
Any help on how to make a music manager script would be very much appreciated thank you.
asked May 03 '12 at 11:53 AM
The problem is that the music playing object exists in the scene to begin with, so when the scene is loaded again, a new instance is loaded as well. Since you can't undo
I personally use this script here to manage all those objects, and tag them "DontDestroy". This script also manages applying the
answered May 03 '12 at 12:45 PM
You can use the singleton pattern. There is a lot of forum posts and questions in Unity Answers regarding this topic.
answered May 03 '12 at 12:49 PM