Skip to content

Commit

Permalink
Store auto refresh toggle state
Browse files Browse the repository at this point in the history
Auto Refresh toggle state now gets stored in editor preferences
  • Loading branch information
Varneon committed Feb 11, 2022
1 parent a62d255 commit 44f102c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Assets/Varneon/UdonExplorer/Editor/UdonExplorerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private bool
showPublicVariables,
showExportedSymbols,
showSymbols;
private const string UseAutoRefreshPreferenceKey = "Varneon/UdonExplorer/UseAutoRefresh";

[MenuItem("Varneon/Udon Explorer")]
public static void Init()
Expand All @@ -37,6 +38,11 @@ private void OnEnable()

cursorChangeRect = new Rect(currentScrollViewWidth, 0, 3, position.height + 48);

if (EditorPrefs.HasKey(UseAutoRefreshPreferenceKey))
{
useAutoRefresh = EditorPrefs.GetBool(UseAutoRefreshPreferenceKey);
}

listView = new UdonListView(new TreeViewState(), UdonListView.Header())
{
Explorer = this
Expand Down Expand Up @@ -77,7 +83,15 @@ private void OnGUI()
{
using (new GUILayout.HorizontalScope(EditorStyles.helpBox))
{
useAutoRefresh = GUILayout.Toggle(useAutoRefresh, "Refresh On Focus");
using (var scope = new EditorGUI.ChangeCheckScope())
{
useAutoRefresh = GUILayout.Toggle(useAutoRefresh, "Refresh On Focus");

if (scope.changed)
{
EditorPrefs.SetBool(UseAutoRefreshPreferenceKey, useAutoRefresh);
}
}

if (GUILayout.Button("Refresh", GUILayout.Width(60)))
{
Expand Down

0 comments on commit 44f102c

Please sign in to comment.