unityEditor 相关

 

使用DelayedTextField进行 F2浮动Text修改名字:

 

   if (IsSelected && Event.current.type != EventType.Layout
                && Event.current.type != EventType.Used
                && Event.current.keyCode != KeyCode.Backspace
                && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
            {
                GUI.SetNextControlName(FocusHEADNAME);
                string name = EditorGUI.DelayedTextField(editorRect, HeaderText, EditorStyles.boldLabel);
                EditorGUI.FocusTextInControl(FocusHEADNAME);
                if (name != HeaderText)
                {
                    HeaderText = name;
                    GUI.Label(labelRect, HeaderText, EditorStyles.boldLabel);
                }

                isEnterClick = true;
                isHeadCanEditor = false;
                EditorGUI.FocusTextInControl(null);
                Event.current.Use();
                // return;
            }

            if (IsSelected && isHeadCanEditor)
            {
                GUI.SetNextControlName(FocusHEADNAME);
                string name = EditorGUI.DelayedTextField(editorRect, HeaderText, EditorStyles.boldLabel);
                EditorGUI.FocusTextInControl(FocusHEADNAME);
                if (name != HeaderText)
                {
                    HeaderText = name;
                  //  GUI.Label(labelRect, HeaderText, EditorStyles.boldLabel);
                }
            }

 

上一篇:Unity在编辑器内添加自定义菜单


下一篇:关于UnityEditor导致系统无法转移焦点的问题