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:
parent
5d45300935
commit
55dddf8142
@ -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)]
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user