mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Potential fix for the main asset/rename problem in newer versions of Unity
This commit is contained in:
parent
c9e1ef1c92
commit
1ef3896893
@ -50,9 +50,10 @@ namespace XNodeEditor {
|
|||||||
if (GUILayout.Button("Revert to default") || (e.isKey && e.keyCode == KeyCode.Return)) {
|
if (GUILayout.Button("Revert to default") || (e.isKey && e.keyCode == KeyCode.Return)) {
|
||||||
target.name = NodeEditorUtilities.NodeDefaultName(target.GetType());
|
target.name = NodeEditorUtilities.NodeDefaultName(target.GetType());
|
||||||
NodeEditor.GetEditor((XNode.Node)target, NodeEditorWindow.current).OnRename();
|
NodeEditor.GetEditor((XNode.Node)target, NodeEditorWindow.current).OnRename();
|
||||||
|
AssetDatabase.SetMainObject((target as XNode.Node).graph, AssetDatabase.GetAssetPath(target));
|
||||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
|
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
|
||||||
Close();
|
Close();
|
||||||
target.TriggerOnValidate();
|
target.TriggerOnValidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Rename asset to input text
|
// Rename asset to input text
|
||||||
@ -60,9 +61,10 @@ namespace XNodeEditor {
|
|||||||
if (GUILayout.Button("Apply") || (e.isKey && e.keyCode == KeyCode.Return)) {
|
if (GUILayout.Button("Apply") || (e.isKey && e.keyCode == KeyCode.Return)) {
|
||||||
target.name = input;
|
target.name = input;
|
||||||
NodeEditor.GetEditor((XNode.Node)target, NodeEditorWindow.current).OnRename();
|
NodeEditor.GetEditor((XNode.Node)target, NodeEditorWindow.current).OnRename();
|
||||||
|
AssetDatabase.SetMainObject((target as XNode.Node).graph, AssetDatabase.GetAssetPath(target));
|
||||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
|
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
|
||||||
Close();
|
Close();
|
||||||
target.TriggerOnValidate();
|
target.TriggerOnValidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user