Search Unity

Question HDRP instantiating grass gameobjects in runtime huge slow down (Alternatives?)

Discussion in 'World Building' started by vagelis199, May 30, 2022.

  1. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    183
    Hi! I'm trying to instantiate grass to fill areas of my terrain with grass, this has to happen in runtime, but instantiating 10k or 100k gameobjects causes a huge slowdown. What can I do in this case?

    Edit: My process, I instantiate a grass game object that has only LOD 0 and culling and a custom shader for grass that works fine when used in terrain as a tree. So no performance issue there.
     
    Last edited: May 30, 2022
  2. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    183
    So apparently the problem was, i had a leftover "find gameobject" loop, which made the huge slow down, since there was thousand of gameobject to look from.