1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-06 07:14:56 +08:00

Allow naming nodes in Init

This commit is contained in:
Thor Brigsted 2019-01-21 22:25:05 +01:00
parent 8c731a9947
commit 3972ac5abf
2 changed files with 2 additions and 2 deletions

View File

@ -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();

View File

@ -76,7 +76,7 @@ namespace XNode {
NodeDataCache.UpdatePorts(this, ports);
}
/// <summary> Initialize node. Called on creation. </summary>
/// <summary> Initialize node. Called on enable. </summary>
protected virtual void Init() { }
/// <summary> Checks all connections for invalid references, and removes them. </summary>