Problem with looping Sound Effects!!!

I have five footstep sounds which I play at random as player moves using the PlayOnce function of Audio. But every now and again one of the sounds will get stuck in a constant loop.
None of the sounds have loop enabled and its a different one of the 5 step sounds each time, so it`s definatly not just 1 of the sound fx having loop enabled.

I feel like its getting confused if I play a Footstep sound that is already playing maybe, then it loops constantly!
Is this a known bug in Unity, should I check each sound isn`t already playing before I use the PlayOnce function of Auido?

Thanks

Three things, Make sure that you stop the sound before starting a new sound, set the AudioSource’s loop to false and always use the same AudioSource.

Past that, check your code against what I have here:

// method using a list of sounds

var clips : AudioClip[];
var runningStepsPerSecond = 1.5;
var walkingStepsPerSecond = 1.0;
private var moveState=0;// 0 stopped, 1 walking, 2 running
private var lastStep=0.0;

function Start(){
	if(clips.length==0) return;
	if(!audio) gameObject.AddComponent(AudioSource);
	
	audio.volume=1;
	audio.loop=false;
	audio.playOnAwake=false;
	audio.dopplerLevel=0.0;
	audio.rolloffMode = AudioRolloffMode.Linear;
	audio.maxDistance=30.0;
}

function Update(){
	if(clips.length>0){
		if(moveState > 0){
			var speed=1 / walkingStepsPerSecond;
			if(moveState==2) speed=1 / runningStepsPerSecond;
			if(lastStep + speed < Time.time){
				audio.Stop();
				audio.clip = clips[Random.Range(0,clips.length)];
				audio.Play();
				lastStep = Time.time;
			}
		}
	}
}

// this method is using a pitch change rather thant a list of sounds

var clip : AudioClip;
var runningStepsPerSecond = 1.5;
var walkingStepsPerSecond = 1.0;
private var moveState=0;// 0 stopped, 1 walking, 2 running
private var lastStep=0.0;

function Start(){
	if(!clip) return;
	if(!audio) gameObject.AddComponent(AudioSource);
	
	audio.volume=1;
	audio.loop=false;
	audio.playOnAwake=false;
	audio.dopplerLevel=0.0;
	audio.rolloffMode = AudioRolloffMode.Linear;
	audio.maxDistance=30.0;
	audio.clip = clip;
}

function Update(){
	if(!clip)
	if(moveState > 0){
		var speed=1 / walkingStepsPerSecond;
		if(moveState==2) speed=1 / runningStepsPerSecond;
		if(lastStep + speed < Time.time){
			audio.Stop();
			audio.pitch = Random.Range(0.8, 1.2);
			audio.Play();
			lastStep = Time.time;
		}
	}
}

I also added a second method where you use 1 clip and change the pitch every new step. I think a better approach to the method then a list of sounds. You can go a step further (pun intended) and set up multiple types of sounds. pavement, metal, snow or whatever matches your environment.

None of this really works unless you time it to the animation of the character. Devise some method of telling when that footfall should play. Then find out what your character is over, play the appropriate sound and it will be quite believable.