How do I set the size of an in built array using script?
I would normally just set the array size in the inspector but these objects are instantiated at runtime so I cant.
How do I set the size of an in built array using script?
I would normally just set the array size in the inspector but these objects are instantiated at runtime so I cant.
You can declare the size when you declare the array variable, like this:
int[] myNumbers = new int[10];
Read more about built-in arrays here.
If you’re using Javascript, it’s:
var myNumbers : int[] = new int[10];
hope this helps!