// Draw the contents of the editor window private void OnGUI() { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); // Draw base settings GUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); isEnabled = GUILayout.Toggle(isEnabled, "Enabled", GUI.skin.button); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(PREF_ENABLED, isEnabled); Refresh(); } EditorGUI.BeginChangeCheck(); showGrids = GUILayout.Toggle(showGrids, "Show Grids", GUI.skin.button); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(PREF_SHOW_GRIDS, showGrids); SceneView.RepaintAll(); } GUI.enabled = isEnabled; EditorGUI.BeginChangeCheck(); snapToGrid = GUILayout.Toggle(snapToGrid, "Snap To Grid", GUI.skin.button); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(PREF_SNAP_TO_GRID, snapToGrid); } GUI.enabled = true; GUILayout.EndHorizontal(); // Draw grid and prefab settings EditorGUI.BeginChangeCheck(); settings.Draw(); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } EditorGUILayout.EndScrollView(); }
// Draw the contents of the editor window private void OnGUI() { bool wasEnabled = settings.isEnabled; scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUI.BeginChangeCheck(); settings.Draw(); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } if (wasEnabled != settings.isEnabled) { Refresh(); } EditorGUILayout.EndScrollView(); }