public void OnDisable() { ResourceCleaner componentInParent = GetComponentInParent <ResourceCleaner>(); if (componentInParent != null && componentInParent.CleanOnDisable) { this.DestroyResources(); } }
public void OnDestroy() { ResourceCleaner componentInParent = GetComponentInParent <ResourceCleaner>(); if (componentInParent == null) { this.DestroyResources(); } if (OnDestroyCallback != null) { OnDestroyCallback(base.gameObject); } }