- Home /
JavaScript multidimensional array editing
Is is possible to use Array.RemoveAt or Array.splice with the newly implimented (Unity 3.2) JS multidimensional arrays? For instance, say I initialize a 2x2 array thusly:
var myArray : new int[2,2];
myArray[0,0] = 1;
myArray[0,1] = 3;
myArray[1,0] = 5;
myArray[1,1] = 2;
When I try to:
myArray.RemoveAt(0);
it returns an error: 'RemoveAt' is not a member of 'int[,]'.
I'm trying to cycle through a set of arrays, testing if the 1st, 2nd, 3rd, etc. values match an external value, and if they don't, deleting the array the unmatching value is contained in from the larger array containing the set. Application is iPhone based so efficiency is also a factor, would creating a custom class that contains an array be a drain?
Thanks!
Answer by Eric5h5 · Mar 25, 2011 at 06:10 AM
No, those kinds of arrays have a fixed size, just like int[] arrays.
Herm...Well is there any way to get around this? Can non-built-in JS Arrays function as multidimensional/array-of-arrays?
Yes, you can make arrays of Arrays, though it would be better to use arrays of Lists.
Your answer
![](https://koobas.hobune.stream/wayback/20220613114747im_/https://answers.unity.com/themes/thub/images/avi.jpg)