Hi!
Im having this weird issue after updating Unity. After changing the version in the build window in my current preset and doing any action with prefab or scene and saving it, I got endless spam of these 2 errors:
The second one is empty after the “:”, and the first one does not say much to me either.
Not changing build version is helping, but that’s annoying since I’m currently in the heavy QA testing stage of my project and I need my builds to have the proper version.
What should I do?
I only have a hunch that this may be due to some editor script in the project using AssetDatabase methods where it’s no longer valid to do so. Mainly AssetPostprocessor callbacks cannot write assets until OnPostProcessAllAssets is called. There may be other cases.
But the callstack doesn’t seem to indicate this.
Perhaps resetting the editor layout helps (top right corner) because sometimes you’re left with a stray, zero-sized, invisible editor window that still runs its editor window code. I just say this because it happened to me twice over the years.
You should check for any InitializeOnLoad(Method) or events that trigger after an asset import. I can imagine some script will try to do the same thing over and over again.
If you have found suspects, connect the debugger and set breakpoints to observe how often they get called respectively whether they don’t have any safeguards against looping.
Ok, everything fixed itself after I deleted the Build profiles that were created by my colleague on Mac and uploaded via git (I’m on WIndows). Idk how and why but this helped.
After that, I created my own build profiles with the exact same settings and everything is working fine with them.
I have reverse problem, default Android profile does not cause infinity loop, however if i create custom build profile and use it, it causes infinity loop.
It seems to me that the problem is with custom packages or assets use ScriptDefines to add defines, however they are added wrongly.
Check this:
Try to implement this logic to your packages, maybe it will work.
Thank you very much. When I commented out PlayerSettings.SetScriptingDefineSymbols(bt, defines);, everything worked fine. It seems that this statement has a problem in Android profile.
No prob, but i should say that commenting that line instead of fixing that code may create issues with your usage of asset and it’s scripting defines. So, if you can, it’s still better to properly set scripting defines.
The problem with infinite re-import seems to arise when code trying to set scripting defines for build target when there is custom build profile active.
It seems that old code is setting scripting defines for default build profile, but since we have custom build profile active scripting defines there had not been set, and when unity checks if there is scripting defines set (it checks our custom build profile) it could not find them and re-imports again.
P.S. It would be great if you could paste some code here for us to see (method where scripting defines are set)