Okay basically I’m trying to write a script that plays an audio clip on loop when I move, but when i take my finger off the w/forwards key, the clip still keeps playing. I’m totally new to scripting and unity so i’m not too sure how to sort this out, i was thinking i’d have to make another piece of script where audio.loop = false but not sure how to do it. any ideas?
var AudioFile : AudioClip;
function Update() {
if (Input.GetKeyDown (KeyCode.W))
{
audio.clip = AudioFile;
audio.loop = true;
audio.Play();
}
}