public virtual void Disconnect() { // we could get this while we are in an active capture, if selection // changes. in that case we need to terminate gracefully. if (activeWidget != null) { EndCapture(null); } if (targetWrapper != null) { targetWrapper.Target.OnTransformModified -= onTransformModified; } // if we created an internal group SO, get rid of it if (internalGroupSO != null) { internalGroupSO.RemoveAllChildren(); parentScene.RemoveSceneObject(internalGroupSO, true); internalGroupSO = null; } // same for xform if (internalXFormSO != null) { internalXFormSO.Disconnect(); parentScene.RemoveSceneObject(internalXFormSO, true); internalXFormSO = null; } }