Search Unity

Question Marking object as 'static' increase lag!

Discussion in 'Global Illumination' started by NicoBacc, Jan 22, 2021.

  1. NicoBacc

    NicoBacc

    Joined:
    Dec 10, 2020
    Posts:
    18
    Hi guys,
    i'm making a racing game which has a little open city. Yesterday I tried to mark all the buildings as "static". After 20-30 minutes of baking process, I tried the game and it was extremely lagging! Today I waited for the global illumination process to finish (it tooks 10 minutes) but again, the fps drops from 60 to 10-15. And every time I build the game, the global illumination background process starts again (why even If I didn't change anything?).
    So, If I leave the object as non static the game is smooth..I thought that marking them as static should have increased the performance. Do I miss something?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Have you tried profiling your game in order to pinpoint the issue? Baked GI should not affect the runtime performance at all.
     
  3. NicoBacc

    NicoBacc

    Joined:
    Dec 10, 2020
    Posts:
    18
    I tried but I didn't understand too much. I need to check how to see all the values and variables/ui elements used during each frame. But apart from that, I think it's strange that making my buildings statics (they are about 100-120 buildings) the game lag, while withouth the static mode it's smooth at 60 fps or more.
     
  4. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    Can you post a screenshot of the lighting window?
     
  5. NicoBacc

    NicoBacc

    Joined:
    Dec 10, 2020
    Posts:
    18
    Sure!
    That's my settings for the lights:

    upload_2021-1-22_18-9-53.png upload_2021-1-22_18-10-0.png

    Is it normal that every time I build the project, even with no change, the global illumination task starts? This happens only when I have the statics buildings
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Uncheck Auto Generate, and generate lighting manually instead.
     
  7. NicoBacc

    NicoBacc

    Joined:
    Dec 10, 2020
    Posts:
    18
    Ok, I'll try. What's the difference by generating lights manually? And when do I need to generate again all the lights?
     
  8. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    The only difference is convenience. Auto Generate is handy when you are iterating on lighting (constantly moving, adding lights, etc.) as it bakes lighting as soon as there are changes.
    Baking lighting manually will not affect the output. The only difference being that you will have to click Generate Lighting button yourself, that's all.
     
    NicoBacc likes this.
  9. NicoBacc

    NicoBacc

    Joined:
    Dec 10, 2020
    Posts:
    18
    Oh, that's why every time I build the project I have to wait 20 minutes. Thank you!