Example #1
0
        public void OnDisable()
        {
            ResourceCleaner componentInParent = GetComponentInParent <ResourceCleaner>();

            if (componentInParent != null && componentInParent.CleanOnDisable)
            {
                this.DestroyResources();
            }
        }
Example #2
0
        public void OnDestroy()
        {
            ResourceCleaner componentInParent = GetComponentInParent <ResourceCleaner>();

            if (componentInParent == null)
            {
                this.DestroyResources();
            }
            if (OnDestroyCallback != null)
            {
                OnDestroyCallback(base.gameObject);
            }
        }