Can you disable the autorecompile?

Unity recompiles/builds the project once the window regains focus. I am working on a really big project that needs to be refactored, resulting in me needing to look a lot of stuff up in Unity and then moving back to Visual Studio. However each time I switch to Unity I need to wait a few seconds for it to recompile.

Is it possible to disable this? Maybe only recompile when clicking on run.

Uncheck this option:

  • Mac: Unity > Preferences > General > Auto Refresh

  • Windows: Tools > Options > General > Auto Refresh

You can compile with Assets > Refresh or its hotkey (Cmd-R for Mac or Ctrl-R for Windows).

This has changed over the years. In 2019.3 there are two options:

  • Auto Recompile - Edit Mode ( Preferences > General > Auto Refresh )
  • Auto Recompile - Play Mode ( Preferences > General > Script Changes While Playing )

It certainly seems to be possible. You need to put this script in an Editor folder anywhere in your project, then just click on the appropriate button. After having locked assembly reload and then unlocked, the assemblies will reload on the next time Unity Editor gains focus.

using UnityEngine;
using UnityEditor;

public class AssemblyReloadEditor : EditorWindow {
	System.Action DebugDelegate;
	[MenuItem("Custom/Assembly Reload Editor")]
	public static void Init(){
	bool locked = false;
	void OnEnable(){
		 DebugDelegate = CompilingPrevented;
	void OnGUI(){
		if(EditorApplication.isCompiling && locked){
			DebugDelegate(); //this is just so the console won't be flooded
		GUILayout.Label("Assemblies currently locked: "+locked.ToString());
		if(GUILayout.Button("Lock Reload")){
			locked = true;
		if(GUILayout.Button("Unlock Reload")){
			locked = false;
				Debug.Log("You can now reload assemblies.");
				DebugDelegate = CompilingPrevented;
	private void CompilingPrevented(){
		Debug.Log("Compiling currently prevented: press Unlock Reload to reallow compilation.");
		DebugDelegate = EmptyMethod;
	private void EmptyMethod(){}

There is also a UnityEditorInternal.InternalEditorUtility.RequestScriptReload();, but I couldn’t make it reload the scripts on demand.

I’ve found Unity source code on GitHub Unity-Technologies/UnityCsReference and in particular this script: Editor/Mono/PreferencesWindow/PreferencesWindow.cs

Here is the line that responsible for Editor’s Auto Refresh (which located in Edit → Preferences → General → Auto Refresh checkbox):

EditorPrefs.SetBool("kAutoRefresh", m_AutoRefresh);

By changing “m_AutoRefresh” variable you can switch auto compiling via code, if needed

This is very late answer, however I believe someone who found this article (including the old me), maybe needs another clever solution.

Please try this:

It just makes script compiler disabled only for the play mode. any other assets (materials, shaders, graphic assets) can be refreshed on play mode.