Infinite import loop after updating to Unity 6

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?

3 Likes

Also, the version always returns to “0.2”.

Check if there’s anything else in the editor.log.

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.

Reseting UI layout does not help. And in the log file, it seems like no additional info either… Just the message about the loop and that’s it.

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.

1 Like

Thanks for the report. If it happens again please submit a bug through the editor, we fixed a similar issue recently.

What editor version was this on?

6000.0.23 and 6000.0.24f1

1 Like

6000.0.30f1 - same issue

1 Like

Please check this post:

1 Like

Still happening. 6000.0.32f1
Shouldn’t it stop if it detects an infinite loop? Bit odd detecting such a thing and not doing anything about it.

An infinite import loop has been detected. The following Assets were imported multiple times, but no changes to them have been detected. Please check if any custom code is trying to import them:
Asset Pipeline Refresh (id=574dbfb1a5a571d4ea3e52839ff8e85a): Total: 101.222 seconds - Initiated by StopAssetImportingV2(ForceSynchronousImport | ForceDomainReload)
	Summary:
		Imports: total=0 (actual=0, local cache=0, cache server=0)
		Asset DB Process Time: managed=0 ms, native=59342 ms
		Asset DB Callback time: managed=140 ms, native=0 ms
		Scripting: domain reloads=7, domain reload time=27952 ms, compile time=13786 ms, other=0 ms
		Project Asset Count: scripts=3122, non-scripts=1
		Asset File Changes: new=0, changed=0, moved=0, deleted=0
		Scan Filter Count: 0
	InvokeCustomDependenciesCallbacks: 0.004ms
	InvokePackagesCallback: 11.692ms
	ApplyChangesToAssetFolders: 3.052ms
	Scan: 0.004ms
	OnSourceAssetsModified: 0.007ms
	CategorizeAssetsWithTransientArtifact: 0.024ms
	ProcessAssetsWithTransientArtifactChanges: 105.642ms
	CategorizeAssets: 273.936ms
	ImportOutOfDateAssets: 58537.313ms (44699.975ms without children)
		CompileScripts: 13785.614ms
		CollectScriptTypesHashes: 42.607ms
		UnloadImportedAssets: 0.007ms
		EnsureUptoDateAssetsAreRegisteredWithGuidPM: 7.691ms
		OnDemandSchedulerStart: 1.419ms
	PostProcessAllAssets: 140.273ms
	GatherAllCurrentPrimaryArtifactRevisions: 0.632ms
	UnloadStreamsBegin: 3.172ms
	UnloadStreamsEnd: 0.002ms
	GenerateScriptTypeHashes: 17.001ms
	Untracked: 42146.094ms

The same problem occurs after a project build on version 6000.0.32f1

I have the same problem. As long as I switch to Android, it will import infinitely. There is no problem when I switch to Windows.

Which version are you using?

Any news on this topic?

6000.0.31f1 and all subsequent 6000 versions, including the later 6000.1.0b2

Using the default Android profile will cause an infinite loop, switching to Windows profile will work fine

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)

1 Like