- Home /
my2dArray.Length(0)
Hi to all!
I'm trying to access the x or y length of a 2d builtin array (in UnityScript). Found this very helpful answer: link text
but alas my2dArray.Length(0) doesn't work for me ("it is not possible to invoke an expression of type int") Tried length instead of Length, [ instead of (, nothing. So, where's the catch? The answer I found is very neat and concise, so typo of its author or incompetence of mine?
Many thanks for your help!
Answer by gregzo · Dec 09, 2011 at 12:24 PM
Solved. It was a typo in the answer I read. my2dArray.GetLength(0 or 1) is the correct syntax.
Answer by ks13 · Dec 09, 2011 at 12:19 PM
You're doing it wrong...you said you read the answer.
var map = new String[gridX,gridY];
Basically, gridX = x, gridY = y. Which makes you call totally wrong, you should do :
length = my2dArray[x,y].Length;
I was trying to get the length of one axis of the array only. Solved above.