Page 2 of 2

Re: On/off button for all music in app

Posted: Sat Oct 30, 2021 7:47 am
by RobertK

Turn audio on/off the music player audio source. Like this:

Code (csharp):

  1. var musicPlayer : AudioSource;
    2.
  2. function ToggleAudio () {
  3. if (musicPlayer.isPlaying)
  4. musicPlayer.Stop ();
  5. else
  6. musicPlayer.Play ();
  7. }

Re: On/off button for all music in app

Posted: Fri Sep 23, 2022 4:07 am
by Maxhood95

Please leave the play mode only once, I think it will work for the problem you are having