- Home /
Difference between Static, Dynamic, and Built-In Arrays
the story so far ....
I should do some research before asking this question, but I was unaware of Built-In Arrays, only assuming there were 2 types of array : Static and Dynamic. I put the point out there that research I did revealed static arrays were slightly more efficient than List. Now built-in has thrown me i.e. are they only for ints/floats? or do built-in arrays exist for transform, vector3, etc? (It's just hard sometimes when one doesn't know of the existence of these functions/commands). I was kindly given a link by Fattie to : http://answers.unity3d.com/questions/198318/javascript-array-use-with-a-struct-.html
This came from a discussion here : http://answers.unity3d.com/questions/198318/javascript-array-use-with-a-struct-.html
Could anyone possibly elaborate on Built-In?
Elaborate how?
Built-in arrays are like this:
var foo : GameObject[];
Is that what you mean by static arrays?
yes, and also like with my meshes i.e.
verts = Vector3[24];
uv = Vector2[24];
tris = int[12];
These are what I assumed to be Static arrays. Then the dynamic (of which I don't use so this is probably wrong) myItems = Array(); (parenthesis rather than square brackets).
Answer by Eric5h5 · Oct 03, 2012 at 10:44 PM
I think your question answers itself. :) The Unity docs refer to arrays like GameObject[] as built-in arrays, which is useful since "static array" could potentially be confused with the static keyword. There are a number of collections that could be referred to as dynamically-sized arrays, such as the JS Array class, ArrayList, and generic List.
Thank you for the clarification. I was lost on the ter$$anonymous$$ology, but had the right idea (I think).
Basically a Built-In array is a static array.
I shall read some of the API and look closer for these references.
For example, the ToBuiltin function (if for some reason you were using the JS Array class).
Your answer
![](https://koobas.hobune.stream/wayback/20220613081836im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Reference all objects inside of an Array or List? 2 Answers
combine words of different scenes in a list or array; have each word link to a page 3 Answers
Different timer in a list of gameobject 2 Answers
Selection list from Array Unity - Random - GameObjects array 1 Answer