diff --git a/Scripts/Editor/NodeEditor.cs b/Scripts/Editor/NodeEditor.cs index 8b06c26..bdcb384 100644 --- a/Scripts/Editor/NodeEditor.cs +++ b/Scripts/Editor/NodeEditor.cs @@ -40,9 +40,20 @@ namespace XNodeEditor { } } else { GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30)); + if (HasFocus() && IsRenameKeyPressed()) { + InitiateRename(); + } } } + bool HasFocus() { + return Selection.activeObject == this.target; + } + + bool IsRenameKeyPressed() { + return (Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.F2); + } + /// Draws standard field editors for all public fields public virtual void OnBodyGUI() { // Unity specifically requires this to save/update any serial object.