其他分享
首页 > 其他分享> > unityEditor 相关

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);
                }
            }

 

标签:current,unityEditor,name,EditorGUI,HeaderText,&&,相关,Event
来源: https://www.cnblogs.com/sun-shadow/p/14498996.html