Search found 1 match

Go to advanced search

by RobertK
Sat Oct 30, 2021 7:47 am
Forum: Issues
Topic: On/off button for all music in app
Replies: 11
Views: 8569
 
Jump to post

Re: On/off button for all music in app

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. }

Go to advanced search