- Home /
Array performance on android device
Hi I need to fill 3 arrays with 3 different kind of GameObjects to modify the collider on them later. I make the arrays variable with:
private GameObject[] array1; etc..
and set them to all gameobjects with tag1 for array1, tag2 for array2 etc..
There's 5-50 of each of these game objects and I'm wondering if making the array public so I can set it in the editor instead of setting it in the Awake() would be better.
What's your thoughts on this?
Answer by whydoidoit · Feb 21, 2014 at 02:29 AM
It will improve startup time, but not by anything noticeable.
Second that, you are unlikely to see any performance boost unless your entire executable is just assigning array values all the time.
I have to dispute this answer. Even if it's set in the inspector, the inspector is just a high level, graphical construct that allows you to initialise objects in a visual manner. When running the game, those values all still need to be assigned, so it will do exactly what you'd end up doing manually - assigning an array of the specified length, and then assigning the objects at each index. Just because it's set in the inspector does not mean it magically doesn't need to do anything to initialise it.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
I have to set a Collider[] to Collider - what do? 1 Answer
Detecting OnMouseDown from colliders in an array 1 Answer
Multiple Cars not working 1 Answer