Howdy, Stranger!

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

Unity Music

Hey. I have a problem with the audio in Unity. I have 2 scenes and i have put the same music in both of them. So the first scene is the main menu. I have also put an options menu where there is a volume slider and a mute button. This also exists on the second scene but the adjustments of volume there won't work. I also have Don't destroy on load so the music keeps playing in the second scene too. So the problem is that i can't adjust the volume of the song or mute it after changing scenes. And the reason for that is that i can't access the first scene's audio source through the second scene.

Does anyone know how to do it?

Answers

  • You have your GameObject that plays the soundtrack, right?

    attach a script and on the Awake method type this:

    DontDestroyOnLoad(gameobject);

    This will stop the object from being destroyed while loading scenes.

  • edited May 2020

    Thanks, but this wasn't the problem. Anyway i found the solution. Thank you very much for the help too.

Sign In or Register to comment.