Search Unity

Too Many Game Objects are Causing Low FPS

Discussion in 'General Graphics' started by rowlettgames, Sep 10, 2019.

  1. rowlettgames

    rowlettgames

    Joined:
    Apr 1, 2019
    Posts:
    11
    I've recently started working on a game and as I have been putting more game objects in to my world, I have noticed it has started to accumulate more and more lag. At first I had 81 1x1 planes all arranged in a square, those planes also had a total of ~100 trees on top of them. Each tree had a total of 19 game objects making it up. So in the beginning there was a total of 1,981 game objects. During that time my game ran with around 60 FPS. That is when I decided to take that square and make it even bigger by duplicating all of the objects 9 times. This means that there are 17,829 game objects that are in my game right now, excluding the player and the one rotating cube in my loading screen. Now I am getting 14 - 16 FPS in my game. Does anyone know how to fix this?
     
  2. rowlettgames

    rowlettgames

    Joined:
    Apr 1, 2019
    Posts:
    11
    Okay, so I found a way to sort of fix this. In my game I had ~17,827 game objects that were all unconnected. To fix this, I simply just made the whole thing into a prefab. Although, now my FPS is around only giving me 40 - 50 frames which is still not as much as it used to give me. If anyone could help me to find out what I should do next, I would be very grateful...
     
  3. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    350
    Did you tried to use a static batching?
     
  4. Leohd

    Leohd

    Joined:
    Feb 7, 2017
    Posts:
    32
    Objects that are cloned many times in the scenes must have their Mesh Renderer properties set to minimal. Turn off light probe, reflection probe, etc.
     
  5. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    412
    Right now I'm having FPS problems with regular GameObjects that have NOTHING on them AND they are TURNED OFF! I have no clue what is happening...
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,058
    Make a new post and provide all the details you can
     
  7. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    412
    As usually that was my fault) Used FindObjectOfType in a giant scene)
     
    DevDunk likes this.
  8. LavarBal

    LavarBal

    Joined:
    Aug 20, 2019
    Posts:
    4
    When I clone too many 1 pixel squares it causes lag. Literally 2D object > Sprite > Square plus a rigidbody2d and boxcollider2d. Nothing more..
     
  9. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,058
    That's not weird. If you have too many objects, it will lag
     
  10. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    651
    I made a video about that topic - the solution is: not having too many objects active at the same time, by using custom LOD / streaming.

     
    StarSilver22 and pm007 like this.