From 6aaad5e0cbd3850a82ef3b1051901aebc5cd9e49 Mon Sep 17 00:00:00 2001 From: Woland Date: Mon, 8 Apr 2019 21:29:53 +0200 Subject: [PATCH] NodeGraphEditor: Make CreateNode return created node --- Scripts/Editor/NodeGraphEditor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/Editor/NodeGraphEditor.cs b/Scripts/Editor/NodeGraphEditor.cs index 8a9d2f0..700ccb8 100644 --- a/Scripts/Editor/NodeGraphEditor.cs +++ b/Scripts/Editor/NodeGraphEditor.cs @@ -69,13 +69,14 @@ namespace XNodeEditor { } /// Create a node and save it in the graph asset - public virtual void CreateNode(Type type, Vector2 position) { + public virtual XNode.Node CreateNode(Type type, Vector2 position) { XNode.Node node = target.AddNode(type); node.position = position; if (string.IsNullOrEmpty(node.name)) node.name = UnityEditor.ObjectNames.NicifyVariableName(type.Name); AssetDatabase.AddObjectToAsset(node, target); if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets(); NodeEditorWindow.RepaintAll(); + return node; } /// Creates a copy of the original node in the graph @@ -112,4 +113,4 @@ namespace XNodeEditor { } } } -} \ No newline at end of file +}