public void OnApplicationQuit()
 {
     // In some cases we have monobehaviour's that are bound to IDisposable, and who have
     // also been set with Application.DontDestroyOnLoad so that the Dispose() is always
     // called instead of OnDestroy.  This is nice because we can actually reliably predict the
     // order Dispose() is called in which is not the case for OnDestroy.
     // However, when the user quits the app, OnDestroy is called even for objects that
     // have been marked with Application.DontDestroyOnLoad, and so the destruction order
     // changes.  So to address this case, dispose before the OnDestroy event below (OnApplicationQuit
     // is always called before OnDestroy) and then don't call dispose in OnDestroy
     Assert.That(!_disposed);
     _disposed = true;
     _disposablesManager.Dispose();
 }
 public virtual void OnDisable()
 {
     if (_disposableManager != null)
     {
         _disposableManager.Dispose();
         _disposableManager = null;
     }
 }
Example #3
0
        public virtual void OnApplicationQuit()
        {
            // _disposablesManager can be null if we get destroyed before the Start event
            if (_disposablesManager != null)
            {
                Log.Debug("MonoDependencyRoot ({0}): OnApplicationQuit called, disposing IDisposable's", this.GetType().Name());

                // In some cases we have monobehaviour's that are bound to IDisposable, and who have
                // also been set with Application.DontDestroyOnLoad so that the Dispose() is always
                // called instead of OnDestroy.  This is nice because we can actually reliably predict the
                // order Dispose() is called in which is not the case for OnDestroy.
                // However, when the user quits the app, OnDestroy is called even for objects that
                // have been marked with Application.DontDestroyOnLoad, and so the destruction order
                // changes.  So to address this case, dispose before the OnDestroy event below (OnApplicationQuit
                // is always called before OnDestroy) and then don't call dispose in OnDestroy
                Assert.That(!_isDisposed);
                _isDisposed = true; // Do this before in case there's exceptions, so we don't call it again below
                _disposablesManager.Dispose();
            }
        }
Example #4
0
        public virtual void OnDestroy()
        {
            // _disposablesManager can be null if we get destroyed before the Start event
            if (_disposablesManager != null)
            {
                Assert.That(!_isDestroyed);
                _isDestroyed = true;

                _disposablesManager.Dispose();
                _disposablesManager.LateDispose();
            }
        }
Example #5
0
        public virtual void OnDestroy()
        {
            // _disposablesManager can be null if we get destroyed before the Start event
            if (_disposablesManager != null)
            {
                Assert.That(!_isDestroyed);
                _isDestroyed = true;

                if (decoratableMonoKernel != null)
                {
                    decoratableMonoKernel.Dispose();
                    decoratableMonoKernel.LateDispose();
                }
                else
                {
                    _disposablesManager.Dispose();
                    _disposablesManager.LateDispose();
                }
            }
        }
Example #6
0
        public virtual void Dispose()
        {
            Log.Debug("Zenject: Disposing IDisposable's");

            _disposablesManager.Dispose();
        }
Example #7
0
 public virtual void Dispose()
 {
     _disposablesManager.Dispose();
 }
 public void OnDestroy()
 {
     _disposablesManager.Dispose();
 }