summaryrefslogtreecommitdiffstats
path: root/Scripts/Fold/Editor/FoldWindow.cs
diff options
context:
space:
mode:
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);