|
Post by Adam on Jul 9, 2023 5:33:56 GMT
I've found an interesting case where a Dynamic Sound Group will cause the error "Some objects were not cleaned up when closing the scene" when the scene is changed. MasterAudio is configured not to persist across scenes The Dynamic Sound Group is configured to 'Auto-remove items'
As far as I can tell MasterAudio is not instantiating any new objects when the scene unloads.. Which makes the error message a bit confusing. After some digging it seems to be caused by `GameObject.Destroy()` being called during the DynamicSoundGroupCreator::OnDisable. When its disabled it will call DynamicSoundGroupCreator::RemoveItems, which subsequently calls into a handful of functions in MasterAudio that calls `GameObject.Destroy()`. If I comment these out then the errors seem to go away.
This error happens intermittently. Only happens if DynamicSoundGroupCreator is unloaded before MasterAudio is. If it happens the other way round then the error doesn't occur. I can reproduce the error with an empty scene that has a MasterAudio and DynamicSoundGroup configured as mentioned. When I change the scene using SceneManager.LoadLevelAsync there is roughly a 50% chance the error will occur.
This is in Unity version 2020.3.42f1. I haven't tested in other versions of Unity.
|
|