- Home /
Instantiate without getting tons of objects?
I would like to know, how the terrain's detail, or tree solution works, because I decided to write my own grass management component, and I can create much nicer, and a lot better grass with it. The main problem is that the script generates grass by instantiating a grass prefab, so it creates really much separated objects, so it is unusable. I compared it with simple terrain grass, and my grass can be rendered a lot easier, but the terrain grass can be generated to the whole terrain, that means it has more than 100000 quads, mine almost freezes at 10000 quads. So much thank you in advice!
Answer by tanoshimi · Feb 06, 2016 at 07:46 AM
It sounds like you sort of know the answer to your question already - you don't generate individual blades or clumps of grass as separate Gameobjects - that will bloat your scene and cause unnecessary load. Instead, add each clump of grass as a quad face to a dynamic mesh of grass that covers a reasonable-sized area.
http://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html
Yeah, this has occurred to me before, but now I know I was right, so thank you so much!
Answer by buFFalo94 · Feb 06, 2016 at 02:22 PM
maybe the vertices number you are instantiating is too high try to check your code