0
\$\begingroup\$

Question:

  • Is it possible for me to create a custom script that will fully disable auto refresh everywhere within Unity (not just on script changes; in my case, asset creation/deletion in addition to everything else)?

    • Or is this particular problem a bug that should be fixed by the Unity team (so that unchecking the "Auto Refresh" setting fully disables it in all locations that trigger it)?

My problem:

Unchecking the Asset Pipeline -> Auto Refresh setting doesn't fully disable this "Reload Script Assemblies" behavoiur. (i.e. the "stop everything and prevent you from being able to do anything, Unity is locking down to recompile things" behaviour.)

In particular I found that even though this setting is disabled, it still happens for every new or removed Asset (creating a script via Assets -> Right click -> Select Create -> C# Script, or removing one by going to Assets -> Right click an asset -> Select Delete). I'm not a fan of this Auto Refresh functionality (anywhere in Unity), it's very disruptive and annoying to keep running into it with very minor changes. I'm glad I am able to disable this and manually run the refresh when I'm ready for any of my script changes, but I still run into this frustrating problem.

In addition to the Auto Refresh setting being un-checked, I have my General -> Script Changes While Playing set to Recompile And Continue Playing; this is fine but isn't the culprit as I'm not currently playing when this refreshing happens.

It feels like the problem is that other locations in Unity code that should be respecting the Asset Pipeline -> Auto Refresh setting, but aren't setup to respect it (either because it's a bug, or hasn't been implemented).

There's lots of articles about how to disable auto refresh, but I haven't found any that are specific to new or deleted assets (I've shared some of the links I've found below). Most sources I can find for disabling auto refresh are for updates I make to my existing scripts, for when I'm playing, or for creating a custom script to add my own logic (not quite sure how to do this yet, still researching this path).


A few links that are related to this issue

but aren't similar enough to help me solve this problem:


My system info:

  • Unity version: 2021.3.3f1 Personal
  • OS: MacBook Pro macOS Catalina Version 10.15.7

Side Note: I recently asked this question on the answers.unity.com website (question here), but I found out that site is shutting down soon (on June 23rd, 2022). Using Unity's forum is a mess, so I'm re-asking this here since Stack Overflow/Stack Exchange is a better Q&A community.

\$\endgroup\$
6
  • \$\begingroup\$ EditorApplication .LockReloadAssemblies (and EditorApplication .UnlockReloadAssemblies) seem to be usable. \$\endgroup\$
    – Mangata
    Jun 13 at 3:34
  • \$\begingroup\$ Thanks @Mangata , I'll try getting those to work. \$\endgroup\$ Jun 13 at 12:28
  • \$\begingroup\$ Perhaps explaining what you aim to achieve by disabling auto refresh would yield more helpful responses from people who have faced similar problems. \$\endgroup\$
    – Adam B
    Jun 20 at 22:23
  • 1
    \$\begingroup\$ We’ll I think that extra info helps. It shows that it’s not some technical reason that you need to disable it, but more of a convenience. If it was a technical issue that was blocking some other work it is possible others might have found ways around the issue through completely different means. I don’t know how how to disable auto compilation but I know that you can reduce the time involved if you split up your code into multiple assemblies. It will only recompile assemblies that are in the dependency chain of the changes you make. Perhaps that would improve things. \$\endgroup\$
    – Adam B
    Jun 21 at 9:10
  • 1
    \$\begingroup\$ @AdamB that makes sense. I'll add this detail to the question when I get a chance, thank you. \$\endgroup\$ Jun 21 at 16:30

0

You must log in to answer this question.

Browse other questions tagged .