Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Scripts always recompiling when switching between two editor instances

Discussion in 'Editor & General Support' started by Sharlatan, Sep 8, 2018.

  1. Sharlatan


    Jul 23, 2013
    Is the following editor behavior a bug or intended behavior? Is there something I can do about it?

    • I'm on Windows 10 Pro and am using Unity 2018.2.1f1
    • When I have two instances of Unity Editor open (two different projects). Let's call them instances A and B
    • When instance A has the focus and I switch to instance B, then back again to A, all scripts of instance A get recompiled, even if absolutely no changes were made. At least I think it's all scripts that get recompiled. The reason I came to this conclusion is because I get the "Hold On - Recompiling scripts" dialog for about 15 seconds and I'm specifically working with assemblies to cut down on compilation time. When I just make some changes to a script in Visual Studio and go back to Unity, recompilation normally takes about 1-3 seconds. That's why I believe it's really recompiling everything. I can't imagine how else it could take this long.
    • This also happens with indirect switches. E.g. If I alt+tab from instance A to Firefox, then to instance B, then to Firefox again and then back to instance A
    • It doesn't happen if I just switch focus to anything that is not an Unity editor instance. For example, if I switch from instance A to Firefox/Visual Studio/etc and back again to A, nothing gets recompiled.

    I hope someone has a workaround or at least an explanation for this. Waiting 15 seconds isn't the end of the world but the project's only going to get bigger and it really starts to add up if you switch frequently.

    Thanks a lot and have a nice day!
  2. rayD8


    Mar 7, 2018
    I've got the same issue and same version of Unity.
    I've been avoiding updating due to projects shared by the team.
  3. Codemilker


    Dec 10, 2018
    Same with Unity 2018.2.3f1. I've got a workaround, though: Referring to Sharlatan's example, I deactivated Unity's "Auto Refresh" feature only in instance B(!), where I didn't need it anyway (Edit > Preferences > General > Auto Refresh).

    I noticed a small loading phase (no recompiling, shortly showing mouse cursor loading sign) every time when alt+tab-ing to instance B. This is probably the moment when instance B's Auto Refresh kicks in and somehow breaks something. That would explain why it also happens when not directly switching from instance B back to instance A, which I had experienced too.

    Interestingly, I haven't had this behavior before. In my case instance B, which somehow breaks something when performing the Auto Refresh, is an old Unity 4 project that I recently upgraded to the Unity version mentioned above. I haven't done such an "upgrade leap" on a project for a longer time with other projects, so this might explain why I haven't encountered this behavior before. Additionally, in my case the behavior is not happening the other way around (instance A seems not breaking something).