I have a project that has started to have a large number of assets and I’ve noticed a very significant slowdown on some of my editor scripts. In some cases a script that used to take 40s, was taking 8 minutes.
I’m currently using latest 2019 LTS version.
In these scripts, I do a lot of image processing and generation, which require me to set specific parameters per texture on the importer as well.
I’ve been profiling it and I found the major slowdown cause to be in the SaveAndReimport calls.
I’ve managed to reduce the number of calls by detecting redundant ones. But I’ve reached a point where I can’t remove any more calls.
The thing I find weird, is that by going deeper on what SaveAndReimport is doing, I noticed that it is spending an obscene amount of time looking for AudioMixerControllers, which should have nothing to do with a TextureImporter to begin with.
Profiler screenshot
From what the FindAllAudioMixerControllers actually does, the amount of time it takes should be related to the amount of assets in my project.
I could live with it if this was actually a necessary operation. But to me I don’t see why Unity would have to call this method when reimporting a texture.
Has anyone come across this issue? Is there a way I could prevent Unity from calling this?