- Home /
Is it faster to create a bunch of cubes (around 200k) in the editor or through a script as an array?
I'm pretty new at this of course. I can build an array of cubes and transform them onto the playfield at runtime, or I can build out all my cubes in the Scene view. Since I have so many cubes, I'm wondering if it is better to create them as an array (as I hear these are easier to render).
For all I know, Unity might be putting all those cubes in an array already.
Also, is there any way to have all those cubes on screen without junking up my Hierarchy view?
Answer by Eric5h5 · Oct 17, 2012 at 03:31 AM
You can't create 200K cubes; that's 100X too many. "Creating cubes as an array" isn't a concept that really makes any sense in this context...you can create some cubes and put the references into an array, which I guess makes "an array of cubes", but that has no effect on rendering in any way. Assuming you're talking about something like Minecraft, you use the Mesh class to build meshes that look like a bunch of cubes. There are plenty of topics on the Unity forums that have a lot more detail about this, including code.
Your answer
Follow this Question
Related Questions
How to support Retina display 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Make objects easier to select 1 Answer
Improving script performance 1 Answer
Code optimisation techniques? 1 Answer