As my HDRP project grows, it becomes more and more difficult to use my Unity (currently 2021.3.25) because of the time lost on startup, compilation and entering/exiting play mode.
But the very familiar “Hold on (busy…)” windows show something that may be a issue: Unity seems to spend 90% of this time importing diffusion profiles assets (some twice), some shader graphs (always the same few), and launching a method called UnityEngine.Rendering.HighDefinition.DiffusionProfileSettings.TryToUpgrade.
I’m loosing a considerable time with this issue and I have the feeling that something is wrong in my setup, but I have no clue how to fix it.
Some notes:
These imported diffusion profiles are declared in the HDRP global settings as overrides.
I tested with and without Parallel Import.
some diffusion profiles that are not declared in the HDRP settings seem to be re-imported too on Unity startup (but not on exit play mode and such).
I had this happen to me about a year ago. The inner workings of Unity re-importing when something seemingly unrelated changes are still a mystery to me.
re-building the Library did not solve the issue. Other people working on the same project via GIT, with the same version of Unity, do not have the same issue. I will now try to reclone and reinstall Unity but I don’t see it solved anytime soon…
I finally solved it. The value m_Version in the diffusion profile assets was not the correct one, set to 2 instead of 1.
This was due to the project being upgraded once to HDRP 14 and then downgraded back to HDRP 12. The version number was not correct anymore in these files, the UnityEngine.Rendering.HighDefinition.DiffusionProfileSettings.TryToUpgrade function was called at each compilation and each exit play mode, spending a minute or two and failing to update the file, which is a shame.
Setting manually the m_Version to 1 with a text editor for all the diffusion profile assets in the project solved the issue.