Settings.CleanTemporaryFiles() causing unnecessary long code compile times

Greetings,

Yesterday I updated our FMOD Unity packages and integration from 2.0.8 to 2.1.7 and noticed that something rather annoying has changed.
It would seem that our code compile times have drastically increased as a result of the [InitializeOnLoadMethod] triggering the CleanTemporaryFiles method in the Settings.cs file when significant code change has occurred and Unity recompiles.

Is there a way to safely work around this? What’s the main purpose of this happening each time the InitializeOnLoadMethod is called or can I just remove the [InitializeOnLoadMethod] to not have this slowing everything down as much.

(On a side note, we are working with a rather large project, hence the very noticable freeze when this method is called)

1 Like

Thanks for letting us know about this. In our tests, CleanTemporaryFiles() takes very little time - can you provide any more information on what part of it is slow in your project? Does it trigger a script recompile somehow?

In the meantime, yes - it should be safe to remove the [InitializeOnLoadMethod] attribute - it’s just there to catch any temporary build files that didn’t get cleaned up.

1 Like

@GlowfishInteractive You are genius sir you have updated this for all of us. Thanks for doing this.

Hey @ben_fmod, thank you for the reply. We’re going to keep an eye on it and see if it perhaps had something to do with things happening at the same time by coincidence.

Thanks to all community members for this. :slightly_smiling_face: :slightly_smiling_face: