summaryrefslogtreecommitdiffstats
path: root/Scripts/Fold/Editor/FoldWindow.cs
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-01-06 16:54:30 -0800
committeryum <yum.food.vr@gmail.com>2026-01-06 16:54:30 -0800
commitb1bfb0400c65b2602670bb22eea50a8b9db285a8 (patch)
tree57c6fec8975fa8a0e7a4cbc0e8c6e0c4f730e5cb /Scripts/Fold/Editor/FoldWindow.cs
parent8e860ac8c999fcf115329d6d480e38f6b1fee179 (diff)
Fold: fix save/restore logic
Diffstat (limited to 'Scripts/Fold/Editor/FoldWindow.cs')
-rw-r--r--Scripts/Fold/Editor/FoldWindow.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Scripts/Fold/Editor/FoldWindow.cs b/Scripts/Fold/Editor/FoldWindow.cs
index 814225c..3ba556c 100644
--- a/Scripts/Fold/Editor/FoldWindow.cs
+++ b/Scripts/Fold/Editor/FoldWindow.cs
@@ -37,6 +37,20 @@ public class FoldWindow : EditorWindow
Undo.undoRedoPerformed -= OnUndoRedo;
}
+ void OnFocus()
+ {
+ // If we lost the graph view for any reason, rebuild it. Otherwise, reload to match the asset on disk.
+ if (graphView == null)
+ {
+ graphAsset = LoadOrCreateGraph();
+ ConstructGraphView();
+ }
+ else
+ {
+ graphView.Reload();
+ }
+ }
+
FoldGraph LoadOrCreateGraph()
{
var asset = AssetDatabase.LoadAssetAtPath<FoldGraph>(GraphPath);