Skip to content

Instantly share code, notes, and snippets.

@SiarheiPilat
Created January 15, 2020 15:38
Show Gist options
  • Save SiarheiPilat/df5be47b449862c62b303c40c76bb784 to your computer and use it in GitHub Desktop.
Save SiarheiPilat/df5be47b449862c62b303c40c76bb784 to your computer and use it in GitHub Desktop.
Turns Auto Refresh option (script recompilation, domain reload) on and off.
using UnityEngine;
using UnityEditor;
public class ScriptAutoRefreshControl : MonoBehaviour
{
/// <summary>
/// Turns Auto Refresh option on and off (it is about script recompilation, domain reload).
/// Same as going to Edit -> Preferences -> General and changing Auto Refresh option.
/// </summary>
[MenuItem("Tools/Auto Refresh")]
static void SwitchAutomaticScriptCompilation()
{
EditorPrefs.SetBool("kAutoRefresh", EditorPrefs.GetBool("kAutoRefresh") ? false : true);
//UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); need to repaint prefrences window here!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment