Пример #1
0
        protected virtual void OnDisable()
        {
            if (m_rteCamera != null)
            {
                m_rteCamera.CommandBufferRefresh -= OnCommandBufferRefresh;
                m_rteCamera.RefreshCommandBuffer();
            }

            if (HitTester != null)
            {
                HitTester.Remove(this);
            }

            if (Editor != null)
            {
                Editor.Tools.PivotModeChanged     -= OnPivotModeChanged;
                Editor.Tools.PivotRotationChanged -= OnPivotRotationChanged;
                Editor.Tools.ToolChanged          -= OnRuntimeToolChanged;
                Editor.Tools.LockAxesChanged      -= OnLockAxesChanged;
                Editor.Undo.UndoCompleted         -= OnUndoCompleted;
                Editor.Undo.RedoCompleted         -= OnRedoCompleted;
            }

            DestroyCommonCenter(false);

            if (Model != null)
            {
                Model.gameObject.SetActive(false);
            }

            if (Editor != null && Editor.Tools != null && Editor.Tools.ActiveTool == this)
            {
                Editor.Tools.ActiveTool = null;
            }

            if (m_input != null)
            {
                m_input.enabled = false;
            }

#pragma warning disable CS0618
            OnDisableOverride();
#pragma warning restore  CS0618
        }
Пример #2
0
        private void OnDisable()
        {
            if (GLRenderer.Instance != null)
            {
                GLRenderer.Instance.Remove(this);
            }

            if (HitTester != null)
            {
                HitTester.Remove(this);
            }

            if (Editor != null)
            {
                Editor.Tools.PivotModeChanged -= OnPivotModeChanged;
                Editor.Tools.ToolChanged      -= OnRuntimeToolChanged;
                Editor.Tools.LockAxesChanged  -= OnLockAxesChanged;
                Editor.Undo.UndoCompleted     -= OnUndoCompleted;
                Editor.Undo.RedoCompleted     -= OnRedoCompleted;
            }

            DestroyCommonCenter(false);

            if (Model != null)
            {
                Model.gameObject.SetActive(false);
            }

            if (Editor != null && Editor.Tools != null && Editor.Tools.ActiveTool == this)
            {
                Editor.Tools.ActiveTool = null;
            }

            if (m_input != null)
            {
                m_input.enabled = false;
            }

            OnDisableOverride();
        }