Hi,
I'm trying to play random footsteps at normal intervals but each time I move in my game I can hear a strange looping sound like if the random sounds were playing non-stop. I can't find the solution to my problem. Help would be greatly appreciated, thanks.
var audioSources : AudioClip[];
function Walk()
{
if ( Input.GetAxis( "Horizontal" ) || Input.GetAxis( "Vertical" ) )
{
yield WaitForSeconds (1);
var nextClip = audioSources[Random.Range(0, audioSources.Length)];
audio.clip = nextClip;
audio.Play();
}
}
function Update()
{
Walk();
}
↧