Skip to content

Commit 03dd07b

Browse files
committed
Back VFX Graph Auto Save option behind EditorPrefs to setting saves between editor runs
1 parent 18b47d9 commit 03dd07b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected void OnEnable()
174174
}
175175
};
176176

177-
autoCompile = true;
177+
autoCompile = EditorPrefs.GetBool(VFXView._EDITOR_PREFS_VFX_AUTO_SAVE, true);
178178

179179
graphView.RegisterCallback<AttachToPanelEvent>(OnEnterPanel);
180180
graphView.RegisterCallback<DetachFromPanelEvent>(OnLeavePanel);

com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ public VFXNodeController AddNode(VFXNodeProvider.Descriptor d, Vector2 mPos)
373373

374374
private bool m_IsRuntimeMode = false;
375375
private bool m_ForceShaderValidation = false;
376+
internal const string _EDITOR_PREFS_VFX_AUTO_SAVE = "VFXGraph.AutoSave";
376377

377378

378379
public static StyleSheet LoadStyleSheet(string text)
@@ -436,10 +437,11 @@ public VFXView()
436437

437438
m_Toolbar = new UnityEditor.UIElements.Toolbar();
438439

440+
var autoCompile = EditorPrefs.GetBool(_EDITOR_PREFS_VFX_AUTO_SAVE, true);
439441
var toggleAutoCompile = new ToolbarToggle();
440442
toggleAutoCompile.text = "Auto";
441443
toggleAutoCompile.style.unityTextAlign = TextAnchor.MiddleRight;
442-
toggleAutoCompile.SetValueWithoutNotify(true);
444+
toggleAutoCompile.SetValueWithoutNotify(autoCompile);
443445
toggleAutoCompile.RegisterCallback<ChangeEvent<bool>>(OnToggleCompile);
444446
m_Toolbar.Add(toggleAutoCompile);
445447

@@ -1414,6 +1416,7 @@ public void CreateTemplateSystem(string path, Vector2 tPos, VFXGroupNode groupNo
14141416
void OnToggleCompile(ChangeEvent<bool> e)
14151417
{
14161418
VFXViewWindow.currentWindow.autoCompile = !VFXViewWindow.currentWindow.autoCompile;
1419+
EditorPrefs.SetBool(_EDITOR_PREFS_VFX_AUTO_SAVE, VFXViewWindow.currentWindow.autoCompile);
14171420
}
14181421

14191422
void OnCompile()

0 commit comments

Comments
 (0)