private void OnDestroy()
        {
            if (m_editor != null)
            {
                m_editor.Tools.ToolChanged   -= OnEditorToolChanged;
                m_editor.ActiveWindowChanged -= OnActiveWindowChanged;
            }

            if (m_picker != null)
            {
                m_picker.SelectionChanged -= OnPickerSelectionChanged;
            }

            UnsubscribeEvents();

            if (m_selectionComponentState != null)
            {
                m_selectionComponentState.CanSelect(this, true);
                m_selectionComponentState.IsBoxSelectionEnabled(this, true);
                m_selectionComponentState.CanSelectAll(this, true);
            }

            m_selectionComponentState = null;

            EnableSplineRenderers(false);

            IOC.UnregisterFallback <IMeshDeformerTool>(this);
        }
        protected override void OnSceneActivated(IRuntimeSceneComponent sceneComponent)
        {
            base.OnSceneActivated(sceneComponent);
            m_selectionComponentState = sceneComponent.Window.IOCContainer.Resolve <ISelectionComponentState>();

            if (Current != MeasurementToolType.None)
            {
                DisallowSelection();
            }
        }
        protected override void OnSceneActivated(IRuntimeSceneComponent sceneComponent)
        {
            base.OnSceneActivated(sceneComponent);
            m_scene = sceneComponent;
            m_selectionComponentState = sceneComponent.Window.IOCContainer.Resolve <ISelectionComponentState>();

            if (enabled)
            {
                Enable(true);
            }

            m_input = m_scene.Window.Editor.Input;
        }
        protected override void OnSceneDeactivated(IRuntimeSceneComponent sceneComponent)
        {
            base.OnSceneDeactivated(sceneComponent);

            if (m_selectionComponentState != null)
            {
                Enable(false);
                m_selectionComponentState = null;
            }

            m_scene = null;
            m_input = null;
        }
        private void SetupSelectionComponentAndSubscribeEvents()
        {
            UnsubscribeEvents();

            if (m_editor.ActiveWindow != null)
            {
                SetCanSelect(true);
                m_selectionComponentState = m_editor.ActiveWindow.IOCContainer.Resolve <ISelectionComponentState>();
                SetCanSelect(false);
                SubscribeEvents();
            }
            else
            {
                SetCanSelect(true);
            }
        }