- Home /
How to set up an dynamic array
I want to create the array like the picture,that i can change the size dynamic.but when i write the script: var array:Array=new Array(); I can't see the array parameter on the inspector,i need a help.
Answer by Chronos-L · Apr 18, 2013 at 09:44 AM
Use just var myArray : int[]
and you are good to go. It is not exactly dynamic, but what you are doing is changing its size using the inspector, so it seems dynamic.
What you have wrote is the Javascript array, which I do not recommend. For fixed size array, just go for the usual array, example: int []
, bool[]
, Transform[]
, etc; for dynamic array, you can use the List < Type >
.
Reference:
Your answer
Follow this Question
Related Questions
transform array in javascript 2 Answers
problem accesing arrays 2 Answers
Multidimensional GameObject Arrays 1 Answer
Create a Word Game like Scrabble in Unity? 0 Answers
Creating an inventory/weapon array and ability to scroll through it 1 Answer