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

Use RenameAsset instead of ImportAsset as changed in #149

This commit is contained in:
Simon Rodriguez 2019-06-21 01:53:11 +02:00
parent 781128cc6e
commit 21c732ee61
2 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ namespace XNodeEditor {
public void Rename(string newName) {
if (newName == null || newName.Trim() == "") newName = NodeEditorUtilities.NodeDefaultName(target.GetType());
target.name = newName;
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(target), target.name);
}
[AttributeUsage(AttributeTargets.Class)]

View File

@ -49,7 +49,7 @@ namespace XNodeEditor {
if (input == null || input.Trim() == "") {
if (GUILayout.Button("Revert to default") || (e.isKey && e.keyCode == KeyCode.Return)) {
target.name = NodeEditorUtilities.NodeDefaultName(target.GetType());
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(target), target.name);
Close();
}
}
@ -57,7 +57,7 @@ namespace XNodeEditor {
else {
if (GUILayout.Button("Apply") || (e.isKey && e.keyCode == KeyCode.Return)) {
target.name = input;
AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(target), input);
AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(target), target.name);
Close();
}
}