1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

Renaming node to nothing (#112)

When the name is empty or just whitespaces, it reverts to the original node type name
This commit is contained in:
Simon Rodriguez 2019-02-17 11:57:17 +01:00 committed by Thor Brigsted
parent f6404e9d9d
commit 662e919aaa

View File

@ -106,6 +106,7 @@ namespace XNodeEditor {
}
public void Rename(string newName) {
if (string.IsNullOrWhiteSpace(newName)) newName = UnityEditor.ObjectNames.NicifyVariableName(target.GetType().Name);
target.name = newName;
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
}