Hello,
I'm trying to randomly render sprites from an array, but for some reason, it's not doing what I want it to do. Here's what I have so far:
int randomPawNum;
public Sprite[] catPaw;
void OnMouseDown () {
randomPawNum = Random.Range (0, 6);
GetComponent().sprite = catPaw[randomPawNum];
Debug.Log (catPaw[randomPawNum]);
}
In addition, I get an error that says my index is out of range, but I'm certain the size of my array is 6. Here's a screenshot for verification:
![alt text][1]
[1]: /storage/temp/76200-screen-shot-2016-08-16-at-90908-pm.png
Thanks for reading and any help is appreciated!
↧