Asset database refresh has become very slow

so my project used to take about 10 seconds to recompile every time I entered the editor from VS and about another 5-10 seconds to enter play mode. Now whenever I save in VS and go back to the editor I get AssetDatabase.Refresh popup shows and takes anywhere from 2-4 minutes and another 1-2 to enter play mode. I have added a few assets from the store to my project but they were all pretty small.
Any help with this? Pretty unfeasible to wait up to 5 minutes in-between code changes.

Another workaround is to only refresh assets when you switch to play mode. This will let you quickly switch back and forth between external editors and unity without incurring the refresh penalty, but still get fresh assets when you usually need them (at runtime). You can also use CTRL+r manually to refresh the asset list at need.

  • Disable auto-refresh (Edit > Preferences > Auto Refresh should be unchecked)
  • Follow the advice provided by DireLogomachist in this unity form post and add the following script to your project:

using UnityEditor;
public static class PlayRefreshEditor {
static PlayRefreshEditor() {
EditorApplication.playModeStateChanged += PlayRefresh;

    private static void PlayRefresh(PlayModeStateChange state) {
        if(state == PlayModeStateChange.ExitingEditMode) {

EDIT: Permanent solution (apparently) found.

Hey @Plattadrug , I’m having the same problem, I’m afraid I have not found a permanent solution. However I do have a couple solutions that will fix the problem temporarilty, they might be helpfull.

  1. Restart Unity, this fixes the problem most of the time.
  2. If restarting unity doesn’t work, go to Assets → Reimport All. This will also fix the problem but reimporting could take a long time depending on the size of your project.

Sadly, this seem to be temporary fixes, for me its only a matter of time before unity goes back to being slow in AssetDatabase.Refresh.

EDIT: @Plattadrug , I think I found the permanent solution, in my case it seems I had was a problem with Visual Studio, not Unity.

Go to: Preferences → External Tools → External Script Editor. And see if you have 2 options to pick Visual Studio, like in this screenshot. One that includes the current installed version between the “” (I do not know what those are called) make sure you have THAT one selected and not the other.

My guess is that opening VS as an external tool refreshes a lot of files it shouldn’t be recompiling i.e. those that belong to the Unity Engine. I’m not 100% sure this was the causing the problem, but I’ve not experienced the slow refresh in over a week since I did this.

Actually i found good hack for the following issue. I’ve been looking for the answer for the same question until I noticed that AssetDatabase is documented. I disabled it and from time to time I refresh everything manually which takes significientaly less time. For people who try to solve the same problem here is the class which you need to create in order to get rid of this issue. I haven’t noticed any cons of this solution YET. Maybe sometimes project files are not refreshed but ctrl+r(Assets → Refresh) does the job

// this is important or you want be able to build project because of
// UnityEditor library

using UnityEditor;

public class OnUnityLoad
    static OnUnityLoad()