**This script will do the job!**
var Walk : AudioClip;
function Update () {
if (Input.GetKey("w") || Input.GetKey("a") || Input.GetKey("s") || Input.GetKey("d"))
{
if(!audio.isPlaying) // this line may not even be necessary
audio.Play();
audio.loop = true;
}else
audio.loop = false;
}
**When you press either w,a,s or d then it will play the sound you decide to play.
Hope this helped :D**
↧