Hi,
I want to change the size of an array without using new. I have a 2 dimentional array: GameObject[,] and I need to be able to change it size without using new.
Thanks ! -P
Hi,
I want to change the size of an array without using new. I have a 2 dimentional array: GameObject[,] and I need to be able to change it size without using new.
Thanks ! -P
If it was a one dimensional array you could use Resize, but it just creates a new array anyway.
Have you considered using a List? Maybe simulating the 2-dimensional part with some light math. e.g.
C#:
List<GameObject> list = new List<GameObject>[x*y];
UnityScript:
var list:List.<GameObject> = new List.<GameObject>[x*y];
You could take a look at the reference for Array. There are the differences between builtin arrays (native .NET arrays) and normal Javascript arrays explained and how to resize Javascript arrays.