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

Rename Revert (#164)

- Not working the same way across all versions of Unity.
This commit is contained in:
Adsitoz 2019-06-26 18:08:22 +10:00 committed by Thor Brigsted
parent 5d45300935
commit 55dddf8142
2 changed files with 5 additions and 5 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.RenameAsset(AssetDatabase.GetAssetPath(target), target.name);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
}
[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.RenameAsset(AssetDatabase.GetAssetPath(target), target.name);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
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), target.name);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
Close();
}
}