You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like there's an issue with the order of operations when it comes to IDisposable objects on a scene switch. The EventCallerContainerExtension.OnUnregister() call currently looks like this:
The problem is that when I switch scenes the OnUnregister() method appears to run before EventCallerBehaviour.OnDestroy() is run. This means the disposable.Clear() call occurs before the MonoBehaviour.DestroyImmediate() call, and THAT means the EventCallerBehaviour.OnDestroy() looks at an empty extension.disposable list and doesn't dispose of anything.
My temporary solution has been to change OnUnregister() to destroy the object before clearing the list:
It looks like there's an issue with the order of operations when it comes to IDisposable objects on a scene switch. The
EventCallerContainerExtension.OnUnregister()
call currently looks like this:The problem is that when I switch scenes the
OnUnregister()
method appears to run beforeEventCallerBehaviour.OnDestroy()
is run. This means thedisposable.Clear()
call occurs before theMonoBehaviour.DestroyImmediate()
call, and THAT means theEventCallerBehaviour.OnDestroy()
looks at an emptyextension.disposable
list and doesn't dispose of anything.My temporary solution has been to change
OnUnregister()
to destroy the object before clearing the list:I'm not sure what ramifications this has on the overall system though.
The text was updated successfully, but these errors were encountered: