Specific Footsteps only! Unity FPS

This is part of the code Im using from Alucard Jay.Sorry because im still new to unity…and just started about a week ago.

function PlayFootsteps()
 {
     // Play Audio
     if ( isWalking )
     {
         if ( walkAudioTimer > walkAudioSpeed )
         {
             audio.Stop();
             audio.clip = walkSounds[ Random.Range( 0, walkSounds.Length ) ];
             audio.Play();
             walkAudioTimer = 0.0;
         }
     }
     else if ( isRunning )
     {
         if ( runAudioTimer > runAudioSpeed )
         {
             audio.Stop();
             audio.clip = runSounds[ Random.Range( 0, runSounds.Length ) ];
             audio.Play();
             runAudioTimer = 0.0;
         }
     }
     else
     {
         audio.Stop();
     }

So my question is…I cant just change this code
audio.clip = walkSounds[ Random.Range( 0, walkSounds.Length ) ];
to
audio.clip = walkSounds; right? I tried and i got compile errors.
Any help?

The problem is you have a property that expects a value (audio.clip), and an array of such values (walkSounds). You have to specify which specific item from the array to assign to the property. That’s why you use Random.Range( 0, walkSounds.Length ), it is an index. This index uses Random to return a sound at a random index in walkSounds.

What you could do to get the same sound every time is give it a hardcoded index (be sure it is less than walkSounds.Length). So, for example

audio.clip = walkSounds[1]; 

More info on arrays here.