Steps to reproduce:
1. Open “StartHere” scene in any Unity version 2019.3.10f1 -209.3.12f1.
2. Enter and exit Playmode repeatedly until you see the exception. It occurs about 30-50% of the time.
3. Observe the exception:
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
_MonoManager
Hello. Thanks for responding, but that didn’t solve the problem in a production game, neither the reproduction project.
This is a minor issue, possibly related to exiting playmode during a scene load awaiting activation.
It could be worked around by manually allocating MonoManager in one of the singleton GameObjects, so we’re not in a rush.
Regards.
I checked out the reproduction project you’ve sent me (thanks).
It seems that the issue is only caused in conjunction with the LoadSceneAsync (allowSceneActivation = false) task that exists in the BT, which seems to create some strange behaviour. A quickfix about this, is to add an extra protection check in MonoManager as to when an instance can be created. Please open up MonoManager.cs and change line number #36 to be like this: if ( _current == null && Threader.applicationIsPlaying && !isQuiting ) {
This solves this edge case on my end. Please let me know.
Thanks 🙂