2
\$\begingroup\$

I have a relatively large project (about 8GB) and it is constantly reimporting itself over and over, to the point that I spend 80% of my time waiting for Unity to:

  • Reimport everything
  • Stop hanging.

Even for the smallest of changes (ie. removal of a comment on one line in a script), or changing import settings on an asset can cause these long hangs and reimports.

To make matters worse, this project is also synced over UnityCollabBETA, which throws manual/selective import (auto-refresh is forced on) out the window.

I've also read up that other programs locking asset files (to read them) can also cause Unity to reimport everything as opposed to simply doing a selective import (only reimporting things that has been changed).

I've tried creating blacklists for my auto-backup programs, anti-viruses and anything that would snoop around and/or mess with the Unity Project folders. However, despite those programs not accessing anything, Unity still reimports the whole project every time I alt-tab out.

The only workaround I've found so far is to just kill Unity every time it does it and relaunch it as for some reason it processes the actual changed files first, then hangs itself by going through everything else.

It is also worth noting that I/O is maxed up by Unity (due to the sheer size of the project) and CPU/GPU usage are relatively low (does not exceed 20-30%, assuming nothing else is running in the background).

Note: This has persisted through installs and computers.


Question

How do I stop Unity from reimporting everything without constantly killing Unity?

\$\endgroup\$
3
  • \$\begingroup\$ Is it safe to assume you've reported this to the Unity dev team through the bug tracker? Have they offered any suggestions as to the cause? \$\endgroup\$
    – DMGregory
    Apr 1 '17 at 12:19
  • 1
    \$\begingroup\$ @DMGregory I haven't as the project is too big to upload (well on my internet connection anyway). Could you point to me where I could do so? (Note: Was banned from Unity Answers by a problematic moderator) \$\endgroup\$
    – aytimothy
    Apr 1 '17 at 12:21
  • \$\begingroup\$ The usual approach here is to create a minimum, complete, verifiable example. So, copy your project and start deleting things bit by bit. If the problem stops, that's a good clue that one of the deleted files had something to do with it. If it persists, then you'll slim down the project to something of a shareable​ size. \$\endgroup\$
    – DMGregory
    Apr 1 '17 at 12:23
1
\$\begingroup\$

One option which can in some cases greatly decrease the waiting time after small script changes can be to disable domain reloading and to disable scene reloading in your project settings. You can find this under File -> Project Settings -> Editor. Enable "Enter Play Mode Options" and then leave "Reload Domain" and "Reload Scene" disabled.

However, be aware of the side-effects:

  • Any static variables in your scripts will no longer get reset to the initial values when you restart the game. They will only reset when you restart the Unity editor. A possible workaround for that problem can be a [RuntimeInitializeOnLoadMethod] which resets all static variables.
  • Any arrays which are exposed inspector properties but have no entries in the inspector, will be null instead of arrays with 0 entries.
  • On switching from editor mode to play mode, [ExecuteInEditMode] scripts won't get disabled and re-enabled as usual and there won't be an obligatory OnValidate() call for all scripts either.

None of these behavior differences will affect the game builds, but might result in some unexpected behavior during development.

\$\endgroup\$
0
\$\begingroup\$

I am guessing you have some scripts in your project that is causing this, as it is possible to override Unity's default behavior when it comes to importing assets. I would try to copy the project, remove all scripts and see what happens.

If this removes the problem, then looking for any scripts that imports UnityEditor should help narrow it down further

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.