public void End()
        {
            bool wasRecording = m_Recording;

            if (m_Recording)
            {
                EndRecording();
                m_Recording       = false;
                valid             = true;
                m_LastSearchIndex = EditorGUIUtility.GetSearchIndexOfControlIDList();
            }

            if (Event.current == null)
            {
                Debug.LogError("Event.current is null");
                return;
            }

            if (Event.current.type == EventType.Repaint && !EditorGUI.isCollectingTooltips)
            {
                Execute();
                if (!wasRecording)
                {
                    EditorGUIUtility.SetSearchIndexOfControlIDList(m_LastSearchIndex);
                }
            }

            if (m_WatchForUsed && Event.current.type == EventType.Used)
            {
                valid = false;
            }
            m_WatchForUsed = false;
        }
        public void End()
        {
            bool recording = this.m_Recording;

            if (this.m_Recording)
            {
                this.EndRecording();
                this.m_Recording       = false;
                this.m_Valid           = true;
                this.m_LastSearchIndex = EditorGUIUtility.GetSearchIndexOfControlIDList();
            }
            if (Event.current == null)
            {
                Debug.LogError((object)"Event.current is null");
            }
            if (Event.current.type == EventType.Repaint && !EditorGUI.isCollectingTooltips)
            {
                this.Execute();
                if (!recording)
                {
                    EditorGUIUtility.SetSearchIndexOfControlIDList(this.m_LastSearchIndex);
                }
            }
            if (this.m_WatchForUsed && Event.current.type == EventType.Used)
            {
                this.m_Valid = false;
            }
            this.m_WatchForUsed = false;
        }