Search code examples
arraysxnaindexingtexture2d

Xna error - array of texture2d's


I have an array of Texture2D's set up like this;

map = new Texture2D[30, 18];

However, when I try and refer to map[30, 1] I get an index out of range of array error. Any reason why this would be happening?

Thanks.


Solution

  • C# arrays are indexed from 0, so valid indices for an array of length 30 are 0 to 29.