- Home /
Problems with unity 5
After upgrading to unity 5 and to the new api, a problem started to occur. This message started to appear "IndexOutOfRangeException: Array index out of Range" pointing to this part of the code int rand0 = Random.Range(0,51); GameObject.Find("/Player 0/Cad 0").GetComponent<SpriteRenderer>().sprite = cartas[rand0];
Any suggestions ?
Check the length of your cartas array. Ensure it has a length of 51, as you are going to get a value between 0 and 50, based on Range(0,51).
Answer by lNeves · Apr 03, 2015 at 07:21 PM
solve the problem, while upgrading to unity 5, unity deleted the resources folder and I didnt notice
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Not detecting collision? 1 Answer
Cube Gravity - Apply Gravity to a Curve 0 Answers
Problem occurs in Jumping 0 Answers