Im trying to create a “radio” for my character. I found a script on here to turn the audio clip on. However, I don’t know how to turn the audio clip off. The song has a delayed intro, so initially I thought it was turning on and off already when I pressed “r”. I guess I was wrong though, because it’s not working now. Can anybody help me? Im still really new to Unity.
This is the script im using. What would I need to add to turn it on AND off?
var audioclip : AudioClip;
function Update() {
if (Input.GetKeyDown(“r”)) {
audio.clip = audioclip;
audio.Play();
}
}