- Home /
Fastest way to instantiate thousands of objects at runtime?
We are starting a new hobby project and just started looking at unity. Ultimately, we want to create large dynamic levels composed of something like cubes.
We are able to draw the cubes quickly by combining their meshes. Using the technique mentioned here: http://forum.unity3d.com/viewtopic.php?t=46369 we are able to draw 40,000 cubes at once with good fps.
However, instantiating all of the cubes still takes a really long time. Is there anyway we can speed the cube creation up? (our cube is just a very basic prefab)
Thanks, Steven
Answer by Richard J. Hansen · Apr 26, 2011 at 02:57 PM
I don't think you can speed up the instantiation itself. However, I am assuming you are using some type of loop to make them all. There is usually room for improvement in loops. You would need to post the code for feedback on that.
You might also consider not doing everything at the start of the level. At first just make the stuff the player can see, then slowly instantiate outwards in the background from there.
Your answer
Follow this Question
Related Questions
Reading XML file 0 Answers
How to insert an object after Destroy(gameObject) 2 Answers
Instantiated Objects not being set at ground/terrain level?(Solved) 1 Answer
How to correctly convert Object to GameObject 1 Answer
Checking Instantiate/Destroy has been called | Checking number of scene GameObjects 1 Answer