[2022.04.20.16.26] UdonImportPostProcessor can infinite loop and lock Unity
CyanLaser
UdonImportPostProcessor appears to be a one time recompile all udon program assets and prefabs, but in some situations this system will infinite loop, locking Unity.
Checking the implementation, it will first verify if a Unity pref key exists, do the work, and then set the key. OnPostprocessAllAssets can be called when an asset is saved. Due to this, this method will end up calling itself after modifying one asset, as the pref key is the last thing in the method.
Please set the pref key immediately after checking that it doesn't exist!
I do not have a repro for this bug as I have never had it myself, but have had to help multiple people with it in the last 8 months. Some users have experienced this after importing the Udon SDK in a brand new project.
Log In
CyanLaser
This bug still exists in the latest sdk. [3.1.5]
Found a possible repro case:
- Have a project with a large number of Udon program assets and prefabs using them. Ensure the project can successfully open.
- Change the location of the project. Ex: Rename the project, move project to another folder, or use a different computer.
- Change the project so that asset will be re-imported when opening. Ex: Updating Unity versions (2019.4.29 -> 2019.4.31). Deleting the Library folder might also rerpo
- Open Unity
Observe that Unity will be stuck attempting to import and will never open.
Note, the change recommended by the original post Did Not fix the problem. The project only properly opened after UdonImportPostProcessor.cs was deleted.