Mass object instantiation issue.

Imagine you have a mesh of only 5 or 6 polygons, and you need to instantiate a whole bunch of them. maybe 100. It's like you press hold the mouse button and will instantiate using a timer. every 0.05 sec. So I noticed that the performance falls dramatically( Draw call arises rapidly) . I'm kinda surprised here since unity is able to handle way more polygons, on each frame. So my guess is that objects that are instantiated on runtime are dealt with differently than ones already there before the level starts. i need to add that after instantiation they are static objects. So what's the best solution out there?

Edit: these small objects are sharing the same material however on the moment they are instantiated i give them a random color.


try rolling your own recycling system.

Decide what you think the maximum amount of objects of that type you think will ever have at any one time will be, and instantiate (and disable) that many and add them into an array in Start().

Then, whenever you need one, iterate the array, enable the next object in the array, place it wherever you want it "instantiated" so forth, then when you're done, disable it again.

See this answer for more info.

I'd recommend using the Mesh class to construct a single mesh made from the polygons, rather than having a separate object for each one.