I’m seeing CPU spikes when Resources.Load is used for AudioClips. Specifically, it is the Loading.AwakeFromLoad subroutine that has the spikes, where the Profiler is showing anywhere from 60ms to 700+ms for that process.
Corresponding to these CPU spikes I’m getting hiccups in audio playback, not necessarily from the just loaded audio. I’ve also noticed that Loading.AwakeFromLoad time will go down if I don’t use the audioclip setting DecompressOnLoad (makes sense), but then Loading.LoadFileHeaders will spike when using CompressedInMemory.
In Update, I’m calling a method LoadAndPlay(), wherein Resources.Load is called. I tried making LoadAndPlay() a Coroutine with multiple yields to spread it out over frames, but it’s definitely that one Resources.Load call itself causing the spike. Is there any approach that will allow AudioClips to load at runtime without an impact on framerate?
I’m using a lot of clips, both for sound design and music, and can’t afford to load all these assets when the scene loads. Thanks for any help!