Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
15
Question by RobinWTF · Oct 23, 2013 at 02:05 PM · buildingautomatic

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Jamora · Oct 23, 2013 at 04:04 PM

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(){
         GetWindow<AssemblyReloadEditor>();
     }
     
     bool locked = false;
     
     void OnEnable(){
          DebugDelegate = CompilingPrevented;
     }
     
     void OnGUI(){
         if(EditorApplication.isCompiling && locked){
             EditorApplication.LockReloadAssemblies();
             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")){
             EditorApplication.UnlockReloadAssemblies();
             locked = false;
             if(EditorApplication.isCompiling){
                 Debug.Log("You can now reload assemblies.");
                 DebugDelegate = CompilingPrevented;
             }
         }
         
         Repaint();
     }
     
     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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
21

Answer by Jesdisciple · Nov 30, 2013 at 11:53 PM

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).

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dducrest · Mar 09, 2015 at 09:17 PM 3
Share

re:Jesdisciple correction on windows

Windows: Edit > Preferences > General > Auto Refresh

avatar image illustir · Oct 15, 2015 at 01:31 PM 0
Share

For this one refactor I'm doing this should be more then enough.

avatar image Harinezumi · Nov 17, 2016 at 10:15 AM 0
Share

Although interesting, the accepted solution didn't work for me in Unity 5.4.1 (32-bit version).

This answer is a lot better, lets me manually control when to recompile.

avatar image midnightcrawler1 · Jul 26, 2019 at 01:39 AM 3
Share

moved to Edit > Preferences > General > Auto Refresh

avatar image eaugustinowiczJC · May 16, 2020 at 05:11 PM 0
Share

I had hoped this setting would just completely disable recompiling, but actually it just disables refreshing assets when you first focus back to Unity. Changes you make in the project window can trigger a recompile.

avatar image
4

Answer by chantey · Mar 28, 2020 at 04:52 AM

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 )

alt text


auto-reload.png (125.9 kB)
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image eaugustinowiczJC · May 18, 2020 at 06:05 AM 1
Share

I'm using 2018.4. Not sure if it's the same in other versions, but this setting only applies to the compile that gets triggered by changes made outside of the editor.

$$anonymous$$oving, rena$$anonymous$$g, deleting or adding a script from inside Unity (e.g. in the project window) will still always trigger a recompile even with these settings disabled, which can very rather annoying when you're refactoring and you've got a lot of changes to make.

avatar image chantey · May 18, 2020 at 09:29 AM 1
Share

agreed, i've gotten used to doing all my refactoring, rena$$anonymous$$g and adding scripts in vs code. the experience is far more customizable with things like unity code snippet extensions, ter$$anonymous$$al etc.

avatar image huulong · Mar 02 at 06:43 PM 0
Share

In Unity 2021 (possibly since 2020), the first setting moved to Preferences > Asset Pipeline > Auto Refresh, although the Script Changes While Playing behaviour setting is still in General.

avatar image
2

Answer by appetizermonster · Aug 15, 2016 at 03:02 PM

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:
https://github.com/appetizermonster/Unity3D-RecompileDisabler

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image YinXiaozhou · Sep 29, 2016 at 02:43 AM 0
Share

Remove compiler so Unity never ever be able to compile:). Wow, that is pretty bad ass. Thanks for the new idea.

avatar image
2

Answer by iprogrammer · May 15, 2018 at 06:58 AM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Harinezumi · May 15, 2018 at 07:20 AM 0
Share

Wow, this actually works! Now to encapsulate it into an Editor component...

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Triggered box works automatically for OnMouseEnter for objects inside. 0 Answers

Auto Updating my Game? 0 Answers

Hi please tell me whats wrong with my player script. 1 Answer

.assets file sizes 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges