- Home /
C#: Array containing 6 Vector2 arrays / index
Hey Guys, I've tried to store my texture positions in an array which contains 6 Vector2's per index. I don't know how to do that! A jagged array does not seem to work!
Thanks to everyone who can help!
Comment
Best Answer
Answer by Gizmoi · Sep 02, 2014 at 02:26 PM
To create an array of array of Vector2s, you would do:
var array = new Vector2[numIndices][];
for(int i = 0 ; i < array.Length ; ++i)
{
array[i] = new Vector2[6];
}
where numIndices is the number of indices.
Thanks for your answer, but that's not what I'm trying to do, I just want to store the texture positions, 6 vectors of each block type. If I would be able to use standard Javascript I would write something like var blockTextures = [ [ [0,1], [1,2], [2,3], [4,5], [5,6], [8,9] ], // grass block [ [...]] ]
However I solved it using a multidimensional integer array. Thanks for your help!