4
\$\begingroup\$

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, 2022 at 3:34
  • \$\begingroup\$ Thanks @Mangata , I'll try getting those to work. \$\endgroup\$ Jun 13, 2022 at 12:28
  • 1
    \$\begingroup\$ @AdamB is "How to completely disable auto refresh everywhere (in favor of manually compiling them)" not enough of an explanation? 🤔 That's literally what I'm wanting to achieve, I thought that was short-and-sweet. My background is in web dev and I'm use to being able to control whether things auto-refresh/compile or not... perhaps that's foreign in game dev? I want to completely stop the auto refresh anywhere and everywhere in Unity, to only have the refresh happen when I manually trigger it... the auto-refresh is a horrible user-experience. Is there a better way for me to phrase that? \$\endgroup\$ Jun 20, 2022 at 22:36
  • 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, 2022 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, 2022 at 16:30

1 Answer 1

1
\$\begingroup\$

I am using Unity 2022.2 and Unity 2021.3 (LTS).

Auto refresh was off but I've seen that 2 different projects had different versions of Burst. And in both cases Burst had the "chain link" icon (installed as a dependency)

The solution in my case was: I reinstalled Burst by name (Packager Manager -> "+" sign -> "Add packager by name.. -> added "com.unity.burst"). Installed version is 1.8.4. This seems to have solved it. Some settings might have been reinitialized.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .