I have a script to add footstep sound in my character . When my character move, the sound is playing but not in static looping . I need footstep sound in static looping. this is my script.
#pragma strict
var Steps : AudioClip[];
function Start(){
}
function Update () {
if (Input.GetAxis( "Horizontal" ) || Input.GetAxis( "Vertical" )){
audio.clip = Steps[Random.Range(0, Steps.Length)];
audio.loop= true;
audio.volume = 0.2;
if(!audio.isPlaying)
audio.Play();
}else{
if (audio.isPlaying)
audio.Stop();
}
}
sorry for my english . and I'm so noob. thank you.
↧