private void UpdateTargetInTracker() { if (Target == null) { return; } if (loader && loader != tracker) { loader.UnloadObjectTarget(this, (target, status) => { if (TargetUnload != null) { TargetUnload(target, status); } }); loader = null; } if (tracker && tracker != loader) { var trackerLoad = tracker; tracker.LoadObjectTarget(this, (target, status) => { if (trackerLoad == tracker && !status) { loader = null; } UpdateScale(); if (TargetLoad != null) { TargetLoad(target, status); } }); loader = tracker; } }
protected virtual void OnDestroy() { if (tracker) { tracker = null; UpdateTargetInTracker(); } if (Target != null) { Target.Dispose(); Target = null; } }