Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

How do I fix Index Out Of Range Exception error

$
0
0
I was making a code to highlight the allowed moves for a chess game. Then when I tried to run it in unity I got this error: "IndexOutOfRangeException: Array index is out of range." Anyone know how to fix('if (moves[i, j]' is the line with the error) . public void HighlightAllowedMoves(bool[,] moves) { for(int i = 0; i <= 8; i++) { for (int j = 0; j <= 8; j++) { if (moves[i, j]) { GameObject go = GetHighlightObject(); go.SetActive(true); go.transform.position = new Vector3(i + 0.5f, 0, j + 0.5f); } } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>