From 55dddf814282a95b33f5eb40ce31595ad88cb1ba Mon Sep 17 00:00:00 2001 From: Adsitoz Date: Wed, 26 Jun 2019 18:08:22 +1000 Subject: [PATCH] Rename Revert (#164) - Not working the same way across all versions of Unity. --- Scripts/Editor/NodeEditor.cs | 2 +- Scripts/Editor/RenamePopup.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/Editor/NodeEditor.cs b/Scripts/Editor/NodeEditor.cs index 19b71f3..76f4fe6 100644 --- a/Scripts/Editor/NodeEditor.cs +++ b/Scripts/Editor/NodeEditor.cs @@ -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.RenameAsset(AssetDatabase.GetAssetPath(target), target.name); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target)); } [AttributeUsage(AttributeTargets.Class)] diff --git a/Scripts/Editor/RenamePopup.cs b/Scripts/Editor/RenamePopup.cs index 1b4f718..5a80d59 100644 --- a/Scripts/Editor/RenamePopup.cs +++ b/Scripts/Editor/RenamePopup.cs @@ -49,16 +49,16 @@ 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.RenameAsset(AssetDatabase.GetAssetPath(target), target.name); - Close(); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target)); + Close(); } } // Rename asset to input text else { if (GUILayout.Button("Apply") || (e.isKey && e.keyCode == KeyCode.Return)) { target.name = input; - AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(target), target.name); - Close(); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target)); + Close(); } } }