diff --git a/Scripts/Editor/NodeGraphEditor.cs b/Scripts/Editor/NodeGraphEditor.cs index 20f5657..81a53c8 100644 --- a/Scripts/Editor/NodeGraphEditor.cs +++ b/Scripts/Editor/NodeGraphEditor.cs @@ -65,7 +65,7 @@ namespace XNodeEditor { public virtual void CreateNode(Type type, Vector2 position) { XNode.Node node = target.AddNode(type); node.position = position; - node.name = UnityEditor.ObjectNames.NicifyVariableName(type.Name); + if (string.IsNullOrEmpty(node.name)) node.name = UnityEditor.ObjectNames.NicifyVariableName(type.Name); AssetDatabase.AddObjectToAsset(node, target); if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); NodeEditorWindow.RepaintAll(); diff --git a/Scripts/Node.cs b/Scripts/Node.cs index 881a297..4a9ace9 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -76,7 +76,7 @@ namespace XNode { NodeDataCache.UpdatePorts(this, ports); } - /// Initialize node. Called on creation. + /// Initialize node. Called on enable. protected virtual void Init() { } /// Checks all connections for invalid references, and removes them.