From b1bfb0400c65b2602670bb22eea50a8b9db285a8 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 6 Jan 2026 16:54:30 -0800 Subject: Fold: fix save/restore logic --- Scripts/Fold/Editor/FoldWindow.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Scripts/Fold/Editor/FoldWindow.cs') 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(GraphPath); -- cgit v1.2.3