Looping audio on footsteps

So i followed one of the tutorials for footsteps. Everything works but my problem is that i dont have just 1 audio but many in an array. so when i use GetKeyDown it only plays on the click but it doesnt loop when u hold it. But if i put GetKey all of the audios just play at the same time and its all bugged. i hope u understood my problem.

GetKeyDown returns true only on the frame in which the key was pressed. If you hold the key down, then any code dependent on GetKeyDown will run just once.

GetKey returns true on every frame that a key currently pressed. If you run some code in Update based on GetKey, then the code will run on every single frame.

When I have done footsteps in the past, I used Animation Events to call a function on the frame when the foot hits the ground. The function could randomly select from an array of footstep sounds.

Without seeing your code, I don’t think we can provide much help.

Hi @BepoIndustry,

Your post provides very little information and not even a code sample. This makes it tiresome to write an answer to. If not for a @dstears’ more-than-adequate answer I would likely close this thread. Here is a template to give you some idea what constitutes a well-written post that will be a joy to answer to: