Question by
jessimmonds · Dec 08, 2017 at 01:05 PM ·
c#buttonaudioaudioclip
How to stop and re-start audio?
Hello.
We have audio in our game that plays throughout multiple scenes. The audio is attached to an empty GameObject called "Audio". We cannot work out how to stop the audio then start it again when you click two separate sound off/sound on buttons. These buttons are images downloaded from an asset.
Have tried this script: using System.Collections; using System.Collections.Generic; using UnityEngine;
public void AudioOff
{
if(audio.isPlaying)
{
audio.Stop();
}
else
{
audio.Play();
}
}
but it doesn't work!! Any help would be much appreciated, trying to hand this project in soon!!! Also total beginners at Unity hence the probably stupid question. Cheers
Comment
Answer by mani3307 · Dec 20, 2017 at 12:40 PM
Not sure but check this
new-text-document-2.txt
(266 B)