Search Unity

Infinite compilation loop after importing PostProcessing

Discussion in 'Package Manager' started by DougRichardson, Aug 17, 2018.

  1. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    In my project, I decided to switch from the github version of PostProcessing v2 to the one managed by the package manager. I deleted the version of PostProcessing I had copied to my Assets folder and then enabled the PostProcessing 2.0.11 package using Package Manager.

    Everything seemed to work, but as soon as I did that I noticed that the compilation spinner never stopped. I looked at Editor.log and saw that Unity appeared to be in a loop doing the same thing over and over. A small snippet of what is repeated over and over is below.

    I tried deleting my .vs, Library, and obj folders and also all generated visual studio projects, and then starting Unity. However, when I started Unity, it just went through the asset import process very slowly because it was still stuck in the compilation loop (which I could see interleaved with the asset import process).

    I was not able to reproduce the bug using a new project, so I could have some problem with my project I don't know about. But if anyone has suggestions on how I can stop this I would greatly appreciate it. I'm very confused at the moment.

    Code (csharp):
    1.  
    2. Pass: 1 took 98 milliseconds
    3.   ProcessSitesModule Assembly-CSharp.dll elapsed time:00:00:00.2152639
    4. - Starting compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
    5. - Finished compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
    6. Reloading assemblies after finishing script compilation.
    7. Begin MonoManager ReloadAssembly
    8. Refreshing native plugins compatible for Editor in 1.82 ms, found 10 plugins.
    9. Preloading 3 native plugins for Editor in 0.23 ms.
    10. Mono: successfully reloaded assembly
    11. Refreshing native plugins compatible for Editor in 1.83 ms, found 10 plugins.
    12. Preloading 3 native plugins for Editor in 0.23 ms.
    13.  
    14. ----- Total AssetImport time: 0.387712s, AssetImport time: 0.000000s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]
    15.  
    16. - Completed reload, in  3.330 seconds
    17. Initializing Unity.PackageManager (PackageManager) v2018.2.3 for Unity v2018.2.3f1
    18. Registering platform support modules:
    19. Registered platform support modules in: 0.0244753s.
    20. Native extension for LinuxStandalone target not found
    21. Native extension for WindowsStandalone target not found
    22. - Starting compile Library/ScriptAssemblies/Unity.Postprocessing.Runtime.dll
    23. - Starting compile Library/ScriptAssemblies/Unity.PackageManagerUI.Editor.dll
    24. - Starting compile Library/ScriptAssemblies/UnityEditor.StandardEvents.dll
    25. - Finished compile Library/ScriptAssemblies/UnityEditor.StandardEvents.dll
    26. - Finished compile Library/ScriptAssemblies/Unity.Postprocessing.Runtime.dll
    27. Symbols will be read from Temp\Unity.Postprocessing.Runtime.dll.mdb
    28. Script Module: Unity.Postprocessing.Runtime.dll
    29. Pass: 0 took 22 milliseconds
    30. Pass: 1 took 6 milliseconds
    31. - Finished compile Library/ScriptAssemblies/Unity.PackageManagerUI.Editor.dll
    32. - Starting compile Library/ScriptAssemblies/Unity.Postprocessing.Editor.dll
    33. - Finished compile Library/ScriptAssemblies/Unity.Postprocessing.Editor.dll
    34. - Starting compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
    35. - Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
    36. Symbols will be read from Temp\Assembly-CSharp-firstpass.dll.mdb
    37. Script Module: Assembly-CSharp-firstpass.dll
    38. Pass: 0 took 43 milliseconds
    39. Pass: 1 took 20 milliseconds
    40. - Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll
    41.  
     
  2. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    Note that if, instead of using Package Manager to import Post Processing 2.0.11, I simply drag the PostProcessing folder from
    AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.postprocessing@2.0.11-preview
    into my Assets folder, the infinite build loop does not occur.
     
  3. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    630
    HI @dichardson ,

    It is really hard to tell at a distance what is going on :(. Is your project big? I mean, can you try to strip the content of your project and back stuff and see if the error goes aways at some point?

    I'll reach out to the script compilation team to see if they have an idea.

    Regards,

    Pascal
     
  4. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    630
    Just talked with our scripting team. Here what they had to say about your issue:

    Hope this gonna help you troubleshoot!

    Pascal
     
    DougRichardson likes this.
  5. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    288
    Do you have anything that is triggering the API updater?
    I had the API updater cause infinite loops when using the new Incremental Compiler, so I don't let the API updater to run anymore.
     
  6. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    Awesome. You guys nailed it. Turns out the AQUAS water shader had an InitializeOnLoad that was fighting with PostProcessing and it got into this infinite loop. I'll investigate further on the AQUAS channel (maybe they even have a fix for this right now), but these lines (inside of an AQUAS InitializeOnLoad static constructor) is the culprit:

    Code (CSharp):
    1. if (symbols.Contains("UNITY_POST_PROCESSING_STACK_V2") && results.Length == 0)
    2. {
    3.     symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
    4.  
    5.     symbols = symbols.Replace("UNITY_POST_PROCESSING_STACK_V2;", "");
    6.     symbols = symbols.Replace("UNITY_POST_PROCESSING_STACK_V2", "");
    7.     PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
    8. }
    I didn't even know there was something like InitializeOnLoad! I really appreciate your quick help on this. Would have taken me a long time to track down on my own.

    The one thing that is weird to me is that this does not happen if I just drop in PostProcessing to my Assets folder. It only happens when I import PostProcessing using the package manager. In both cases I was using the same version of PostProcessing. Perhaps something changed regarding the order of the InitializeOnLoad methods when using the package manager version.
     
    Deleted User likes this.
  7. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
  8. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    250
    This should have been fixed a couples of weeks ago.

    Can you confirm it is still happening with 0.0.42-preview.19 ?

    Best
     
unityunity