What does this error mean?

everything works except for the sounds and it still lets me play without um,the error is:
IndexOutOfRangeException: Array index is out of range.
Footsteps+$FootStepsSound$85+$.MoveNext () (at Assets/OG_Scripts/HUD Classes/Footsteps.js:14)

For this script:

var footAudio: AudioClip;
var controller: CharacterController;

private var Run: Run = null;

function Awake(){

function FootStepsSound(){
if (controller.isGrounded && controller.velocity.magnitude > 3){
var volume = Mathf.Clamp01(Time.time);
controller.audio.PlayOneShot(footAudio[Run.stepSound], volume);
yield WaitForSeconds(Run.audioStepLength);
} else {

I don’t know what the error wants me to change, help would be appreciated

Index out of range exception, means that you are trying to access something in a list of some sort that doesn’t exit at that index.

probably controller.audo.PlayOneShot(footAudio[Run.stepSound], volume) is trying to access footAudio[Run.stepSound] does not exist
, but it’s hard to tell, since you don’t format your code!!!

Hope this helps,

The offending piece of code that appears to be causing this exception is the following:


It means that your Run.stepSound value, at the moment of the error, is higher than the amount of audio clips you have in your footAudio array. For instance, if you have 4 audio clips in the footAudio array, and your Run.stepSound is set to 4 or higher (should be between 0 and 3), you will get the IndexOutOfRangeException.