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:
parent
8c731a9947
commit
3972ac5abf
@ -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();
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user