- Home /
Music Volume
Almost every game has background music. There must be working example scripts on how to change the volume! It seems I need to hire someone on Elance to get a working script. I already posted a job listing for this and other tricky questions. I assume a programmer fluent in Unity3D JS could type this code in less than 5 minutes. I already wasted a day on this, which is way to much time.
Problem is, the music is started with the startup screen, obviously. It's attached to an object with DoNotDestroy script, so it keeps playing when scenes change. Now, changing the volume from the settings screen of the game just is the hard problem. Should that not be in standard Q&A, or a script that is included with Unity3D, since pretty much everyone needs that?
Thanks to those who answered. The problem appears to be more complex than expected. A DoNotDestroy will cause to play the music multiple times, adding one each time when returning to the start scene. I gave up on trying to solve this, and decided to circumvent the problem by not using DoNotDestroy, and ins$$anonymous$$d playing the music only in the game scene. It will of cause stop when leaving the scene, and restart from the beginning when re-entering the scene.
Answer by madflyskills · Jun 13, 2013 at 12:07 AM
You should check out SoundManagerPro, it handles this exact type of situation. Otherwise, you should try using a singleton that destroys itself if another instance of it exists:
Your answer
Follow this Question
Related Questions
Separate Listeners for Sound FX and Music? 0 Answers
Music volume decreases after one loop 1 Answer
Problem implementing volume slider 1 Answer
Unity and music tracks - load track at certain point and fading tracks in and out 1 Answer
Low sound volume on phone speaker but normal on headphone 0 Answers