Is all these variables and functions working for Unityscript ?
If the answer is true, so instead of using .length to get the number of elements, I have to use .Count ?
What are the main differences with Array type ?
Is all these variables and functions working for Unityscript ?
If the answer is true, so instead of using .length to get the number of elements, I have to use .Count ?
What are the main differences with Array type ?
Yes, they are supported and yes, you use Count to get the length of the list.
Built-in .NET arrays are not resizable, but the are FAST.
Javascript arrays are resizable, but they have a limited number of useful methods.
ArrayLists are resizable, and have more methods available, such as IndexOf.
I guess choosing either array or arraylist depend on the mood and the available functions !
Thanx you for your quick answer.
If you don’t need the functions ArrayList provides, javascript arrays are easier to create:
var myarray = Array(1,2,3);
You’d have to do this with an ArrayList:
var myarray = new ArrayList();
myarray.AddRange([1,2,3]);
Javascript arrays also play nice with Debug.Log().