[SOLVED] Stopping the Audio on a click of a button…

Updated on February 26, 2016 in [A] Audio
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on February 26, 2016

Hi guys, i am using Brackeys script from his 2D platformer series and it is working wonders for me, changing pitch, random volume and looping is great and really easy to add.

But i can not figure out how to make them all Stop on a click of a button, so how could i do that?

I would like to have a button, click it, stops all music from the Audio Controller, and then it saves that in my Game Controller so next time users turns on the game it remembers if its muted or not.

Now i think i know how to do the Saving and Loading thing but muting it all, i just cant figure that out.

So any help is deeply appreciated! 🙂

EDIT: AudioListener.volume = 0.0f; and setting it on a click and declaring a boolean that its playing is working nicely.

  • Liked by
  • Atik
Reply
1 on February 26, 2016

Would disabling the AudioListener work for you? You probably have to call upon the component, I forget the tutorial.

on February 26, 2016

Thanks a lot! I took a look at it but disabling did not work. 

But putting the AudioListener.volume = 0.0f; seems to work, and now i am saving it to my GameController and all is working! 

Thanks once again 🙂

Show more replies
  • Liked by
Reply
Cancel