Search Unity

What's worked better than combining game objects for optimization...

Discussion in 'General Graphics' started by astracat111, Sep 17, 2019.

  1. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    In my last year of dealing with optimization for my game, a game that's like an rpg that includes quite a lot of varied foliage, forest hiking and rpg villages, at first everyone kept saying that you need to combine your objects. So, at first, maybe for the first 3 or 4 months that's what I focused on. The problem with that is that when you combine your objects into single meshes, like say you combine 5 houses into one or something, the size of your scene starts to get bigger and bigger. I'm assuming this is because the combined mesh data is stored into the scene file.

    So I had this village that was like 200mb because the combined fences, among other things, were taking up quite a lot of space in one of the villages. When you would try to load or save the scene it would take literally 20 seconds on my i5-8300h/ssd laptop. So, I stopped combining game objects.

    What I ultimately found is that the thing that really helped me most was using Per Layer Camera Culling (look up the free script in the asset store) in combination with gpu instancing. Having the terrain gpu instanced also has sped the game up significantly.

    Another thing that you're told over and over again, is that you need to use baked lighting, and yet what's not told to you about this is the same thing about combining game objects, the hit you take with baked lighting is that your game takes up more space on your hard drive when using higher resolution light maps in exchange for the performance that you achieve. Another problem with baked lighting is that you end up not being able to do instant day/night cycles. Baking lighting also takes quite a long time if you're baking detailed high resolution light maps. Real time lighting seems to look infinitely better at an insanely fast speed, but most people will tell you not to use it on mobile platforms except for non-static game objects like characters.

    It's just a couple of thoughts. I decided ultimately to stay away from combining game objects and baked lighting. For slower computers I could use downsampling using the store asset 'X-Frame' instead. It makes the work flow faster and more convenient.