AudioClip[] bug

function EngineSound()
{
audio.pitch = RRwheel.rpm/TopRPM + 0.5;
for(var i = 0;i < Sounds.Length; i++)
{
audio.clip = Sounds*;*

i = Gear;
}
}
i tried to make realistic car sounds by changing the audioClip on each gear. There’s no errors but the unity editor freezes. the script is above the “Sounds” variable is just a AudioClip[];.

i = Gear;

This line will always replace whatever was in “i” with Gear. You are stuck in an infinite loop (since “i” won’t continually be incremented) if Gear < Sounds.Length.