Hi there! I am having an issue with asynchronous loading of AudioSource components. My system relies on the loading of multiple Asset Bundles at roughly the same time, and I’ve found a major issue with this approach.
During the Integration step, where assets are integrated from the background loading thread onto the main thread, if another asset bundle is being loaded in the background loading thread, Loading.LockPersistentManager causes the main thread to stall out until that background loading operation is completed.
This ONLY occurs in the integration step when AwakeFromLoad is called on a component that is an AudioSource. Other components/assets don’t seem to have any issue, so I’d guess they do not need access to the PersistentManager.
Here is an example:
Honestly this seems like a bug to me, but maybe it’s due to how my Audio Source and/or Audio Clips are configured?
Audio Source Settings:
Audio Clip Settings:
This is not an issue just the first time an Audio Source is loaded. It happens even if other Audio Sources are already loaded. I also do not think this issue specifically has to do with Asset Bundles/Addressables, even though I’ve marked the topic thusly. Instead, I am pretty sure it is just something to due with the async loading mechanism which is used by all of the async loading methods (addressables or not). It happens when loading both prefabs and scenes.
Edit: I will also mention that the objects that contain the AudioSource components are in a deactivated state when loaded, so this issue should not be caused by the “Play On Awake” setting. The objects are instead activated a number of frames after being loaded, and I would assume any performance penalty that needs to be paid for the Audio Source would be paid there, but that is not the case.