1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

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-15 17:25:57 +01:00 committed by Simon Rodriguez
parent f6404e9d9d
commit fe05561920

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));
}