gregzo
1
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!
gregzo
3
Solved. It was a typo in the answer I read. my2dArray.GetLength(0 or 1) is the correct syntax.
ks13
2
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;