Question by
The_Ginge_Gamer · Sep 21, 2018 at 10:04 AM ·
first-person-controllerfirst-personindexoutofrangeexception
issue with first person character
I am creating a call of duty zombies style game and am having dificulties with the standard first person character asset. I have not edited the script, but when I play, it comes up with, index is out of range. Here is the bit of code that is not working:
int n = Random.Range(1, m_FootstepSounds.Length); m_AudioSource.clip = m_FootstepSounds[n]; m_AudioSource.PlayOneShot(m_AudioSource.clip); // move picked sound to index 0 so it's not picked next time m_FootstepSounds[n] = m_FootstepSounds[0]; m_FootstepSounds[0] = m_AudioSource.clip;
Comment