Search Unity

Bug Unity stuck at "Preparing Bake"

Discussion in 'Editor & General Support' started by XR_XharpRazor, Oct 1, 2021.

  1. XR_XharpRazor

    XR_XharpRazor

    Joined:
    Apr 3, 2021
    Posts:
    2
    Somewhere a week ago, Unity can still bake light, everything is normal, then starting from 3 days ago, Unity stuck at "Preparing Bake" when the button "Generate Lightning" is clicked.

    The Unity version is 2019.4.30f1
    I have tried to shrink the size of the scene
    I have tried to crank the numbers downwards.
    Realtime Global Illumination is turned OFF
    The used lightmapper is Progressive CPU
    Lighting mode is Shadow Mask
    Auto Generate is turned OFF

    While Unity is preparing to bake, the progress bar jumps around, and sometimes it will flicker between "baking..." and "baking [ETA 00:00:45]" or some sort of time duration

    Although Unity says it is preparing to bake, there is already one lightmap ready, and Unity is just stucking at Preparing bake.

    A few weeks ago, when the project is bigger in size in the scene, somehow Unity can bake it, and now even the scene is smaller, Unity can't bake it.

    How to fix the problem ?
     
    anycolourulike likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,727
    Try perhaps a reimport all.

    There are also global illumination caches you can clear inside of the Library project... perhaps those got corrupted.
     
  3. gnovos

    gnovos

    Joined:
    Apr 29, 2020
    Posts:
    33
    I've got the same problem. It used to bake just fine in about 10 minutes, now it gets stuck at "preparing bake" forever and doesn't move past 5% while the estimated time counter just goes up and up to infinity. I've tried clearing the GI cache, reimporting, removing the library directory, even upgrading twice, all the way to 2022.2.16f1 (the latest at the time of this comment), and the problem persists. I am unable to generate lightmaps at all even through a couple days ago I had no problem. Any help?
     
  4. Moritz5thPlanet

    Moritz5thPlanet

    Joined:
    Feb 5, 2019
    Posts:
    73
    Facing the same issue with 2021.3.24f1 - trying to bake a (newer) project, very small scenes that take about 1-2 minutes to bake on the same machine in 2022.2, but never finish baking in 2021.3 LTS.

    The time just counts up infinitely during "preparing bake".

    upload_2023-5-5_10-46-58.png

    This will count up nearly infinitely into the multiple hours, never counts down (for more than a second of two)
    upload_2023-5-5_10-47-41.png

    Mind you, the scene is super simple and bakes in <2 minutes on 2022.2

    The scene(s) are rather simple, probably around 20-30 units across / radius.
    upload_2023-5-5_10-49-22.png
     

    Attached Files:

  5. C0lonnello

    C0lonnello

    Joined:
    Nov 7, 2022
    Posts:
    30
    Hi, I'm working with Unity 2022.2.18 and I'm having the same issue in a project.
    A bunch of baked lights in the scene, baked lit materials, when I start the baking the process get immediately stuck on "Preparing bake" with the progress bar that jumps from around 5% to 99% with no logic, and with no end to this.

    I have the same settings of another project with same unity version and where I didn't have any problems of this kind. I'd like to know if there are any workaround other than create a new blank project and rebase everyhing in it.
     
  6. gib-gummi

    gib-gummi

    Joined:
    Oct 26, 2021
    Posts:
    1
    Hey!
    Since this took me the better part of two days to figure out, here's what fixed it for me:

    The issue is the same (Unity 2022.2.17f), the remaining time just counting up infinitely during "preparing bake..." / 5% completion. Using any of the any of the baked global illumination visualizers in the Scene View also caused the progress bar to jump up and down, but never making any progress.

    Bugs4.gif


    In my case, the culprit was *an animated shader* is used for parts of my GI contributing geometry. Unplugging the "Time" node in the relevant shader graph resolved the issue.

    From my limited testing, this issue seems to appear when the "Time" node is contributing to either the base color or emission channels of the fragment shader or any of the vertex shader's channels)

    Hope it helps prevent future headaches.
     
    matthewjameslim likes this.
  7. t-ley

    t-ley

    Joined:
    Mar 6, 2017
    Posts:
    77
    Even if it does work right, when it’s a big scene with no lighting probes at all still is super slow wow
     
  8. C0lonnello

    C0lonnello

    Joined:
    Nov 7, 2022
    Posts:
    30

    I managed to find the same solution a couple days ago, I removed from the scene all the objects with animated shaders to find out which was the problem. The thing is that there were no clues on why this could create this problem, and the progress bar behaviour is kinda weird.
     
  9. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    I have the same issue with Unity 2022.3 LTS. I have a strong PC and it stuck at prepare baking.
    Sometimes it works but then it got stuck. Then I have to reimport to have a small chance for it to work.
     
  10. devanglimbad

    devanglimbad

    Joined:
    Oct 10, 2018
    Posts:
    5
    I am experiencing the same issue with Unity 2021.3.25f1 LTS. The first time, it prepares for bake successfully, then it bakes the lighting and finalizes the bake. However, when it starts the reflection jobs, it gets stuck in a loop of "preparing for bake" slider without any end.

    I have tried everything, including checking if any objects in my scene are using animated materials, ensuring that only meshes that should be static are marked as such, changing the light bake settings, and upgrading to Unity 2022 LTS. However, none of these solutions have worked consistently. Sometimes it bakes in one go, while other times it takes forever.

    Please help.
     
    MetaDOS likes this.
  11. devanglimbad

    devanglimbad

    Joined:
    Oct 10, 2018
    Posts:
    5
    Has anyone ever found any solution for this?? I'm frustrated and need to bake lights at high quality, which takes approximately 25 minutes to bake one time on RTX 4080 with 512 direct samples. I can't handle this with Unity baking it multiple times, endlessly and each time it takes 25 minutes!