Search Unity

Why does the fps drop?

Discussion in 'Editor & General Support' started by gamerant, Aug 9, 2013.

  1. gamerant

    gamerant

    Joined:
    Jun 27, 2013
    Posts:
    16
    Hi guys.I have started putting my game together.Level1 has 60-70fps and everything works fine.
    However level2 has only 20fps max.The difference between the two levels is only that level 2 is a bit bigger than level 1.So how come there is this drop in fps?
    Asking since 20fps is just awful to have and makes the game very choppy and was wondering if anyone has any ideas how to fix that.

    P.S : I read in the Answers section that OnGUI could be responsible but i haven't placed any UI in the level yet.

    Any help is appreciated.
     
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    Open the Stats window in the Game view and show us a screenshot of it in your second level.
     
  3. Sessional

    Sessional

    Joined:
    Apr 21, 2013
    Posts:
    45
    FPS is a factor determined by a few crucial components. If you spend a lot of time processing you will have an FPS drop, or if you need to do any memory swaps, these will all add up to drop the FPS.

    Also: if you make draw calls to your graphics card to often, the gpu will end up slowing down. Usually you want to add all the stuff together in to as few draw calls as possible, and spend less time traveling up and down the bus.

    In some scenarios (no idea if unity has this problem) colliding objects that don't have the ability to move can cause a massive amount of physics engine processing. Something like this can drop the FPS by a pretty amazing amount as constant physics calculations are going on. (often times offloaded to a gpu ie. physx)

    A few things to think about: am I drawing more objects then I need to? Can I combine the meshes to help limit draw calls? Do I have a ton of physics options? Are my textures large? Do I have a lot of while or for loops inside of Update()? Can I use coroutines to yield processing time on some operations to allow frames to continue?
     
  4. gamerant

    gamerant

    Joined:
    Jun 27, 2013
    Posts:
    16
    Thanks for the replies :D I was checking the stats for the levels and they were almost the same aside from the fps.I built level 3 to check if the same problem will occur there too but it didn't.
    There is only a max of 10 draw calls being done so I think i'm alright in that aspect as well as the scripts as I try avoiding putting while or for loops inside the Update() function.The textures are reduced to as small a size as i can get away with and I don't think the physics isn't too hard at all.

    I fixed the issue by going back to blender and deleting all the lights that i had put in place when making the model.This seemed to do the trick.

    Cheers for the answers :D