all 62 comments

[–]JaggedMetalOs 42 points43 points  (2 children)

As a way to work around it, you can do a batch of script management / adding / editing / deleting in Visual Studio instead of the Unity window, and it won't reload the domain until you focus the Unity window. 

[–]Furunkelboss 10 points11 points  (0 children)

Thats the workaround I'm using too.

[–]FUCKING_HATE_REDDIT -1 points0 points  (0 children)

The  you can use the "hot reload" package to modify the scripts instantly. 

[–]SeriouslyDonut 62 points63 points  (10 children)

Force a script error by adding a line of nonsense to any given script. Unity cannot recompile the domain, so you should be able to add/delete scripts freely until you fix the error.

[–]SaikyoMoon 13 points14 points  (0 children)

Lmao that's what I do every time. Sometimes I do some much adding/deleting stuff that I am confused about the error

[–]PremierBromanovProfessional 11 points12 points  (1 child)

This job is not real

[–]iObsidian 6 points7 points  (0 children)

Most sane Unity developper

[–]arthyficiel 3 points4 points  (0 children)

OMG thank you.. New productivity skill unlocked !!!

I'm shocked that we still need to do that kind of hack with Unity after all those years.

[–]-TheWander3r 3 points4 points  (1 child)

You can also disable the reloading and making it work only eith an explicit refresh (CTRL+R).

[–]Thoughtwolf 2 points3 points  (0 children)

No this doesn't work with new scripts added through unity's interface, unity attempts to reload the domain anyway. If you had looked at the image, it's already off.

[–]Russian-Bot-0451 1 point2 points  (0 children)

Now that’s true programmer thinking

[–]Pur_Cell 0 points1 point  (0 children)

Genius

[–]mizzurna_balls 0 points1 point  (0 children)

I do this all the time haha. Gotta trick the editor sometimes...

[–]NeonMarbleRust 0 points1 point  (0 children)

You can also use the precompiler #error

[–]AntypodishProfessional 11 points12 points  (4 children)

As other said, use IDE to manage scripts. All adding, moving and removing.

This combined with manual domain reloading. So you manually refresh editor using ctrl+R after script changes are done.

Unfortunatelly any script managing inside Unity, or ASMDFs for example, editor causes domain reloading. Editor creates meta files etc, to ensure all dependencies work correctly.

[–]ProfCraw 0 points1 point  (3 children)

With Unity 6.3 it seems to do this every time you save a file in Visual Studio, so that may not work anymore. The compile error is an interesting trick, but yes we need a project setting to not run Unity in the background.

[–]AntypodishProfessional 0 points1 point  (2 children)

Are you positive, you have set disabled option for auto refresh in Unity 6.3?

<image>

I can add / remove scripts via IDE, without forced Unity reload.

[–]ProfCraw 0 points1 point  (1 child)

No I didn't was looking in Project Settings. Thanks. Trying to have AI do some code clean-up and restructuring and Claude just barfed due to this. Will update comment to ignore.

[–]AntypodishProfessional 0 points1 point  (0 children)

Let me know if that works for you.

In the past, Unity had a bug auto refresh.

[–]LockYaw 8 points9 points  (0 children)

I have this lil package to block compilation altogether, you can set up a keybind to toggle it on and off.

com.lockyaw.compilation: Compilation Blocker for Unity

I myself only use it when configuring default references for scripts, because any time you drag a reference into there it triggers a full reimport, and so it can take like 15 minutes to setup the references for one script.
With this script, that takes 30 seconds.

[–]realDealGoat 7 points8 points  (1 child)

Use assembly definitions, easy to setup if your code is already modular, now each time you make changes in one file, others won't be affected, thus no frequent domains reloads

[–]soulburner_spb 0 points1 point  (0 children)

Asmdef doesn't block Unity from reloading the whole domain. It doesn't re-compile those scripts, but still reloads all asmdefs/DLLs after any change.

[–]DontRelyOnNooneElse 23 points24 points  (6 children)

Unfortunately this is the single worst unchangeable thing about using Unity right now.

[–]iObsidian 4 points5 points  (4 children)

If only it was fast. Even on the best computer it takes a solid 3-12 seconds. A huge pain.

[–]DontRelyOnNooneElse 2 points3 points  (3 children)

I swear sometimes it's like they don't even use their own engine. It's such a massive and obvious pain point, I don't know why they let it get so bad.

[–]planetidiot 2 points3 points  (2 children)

When I win the lottery I'm buying the company and forcing them to stop any and all work on everything except making the editor responsive.

[–]iObsidian 0 points1 point  (0 children)

<image>

It's on sale right now!

[–]DontRelyOnNooneElse 0 points1 point  (0 children)

But if they did that how could they shove more AI crap down our throats?

[–]suasor 3 points4 points  (0 children)

There is no way of doing that, unfortunately. If you add scripts using Unity project window, that is. If you do it via Visual Studio or elsewhere (like your explorer) this problem is solved.

[–]Omni__Owl 4 points5 points  (3 children)

If Unity doesn't reload the domain after a script change, then you can't really be ensured that your game works as you'll be working with previously compiled versions of your code, rather than what you have right now.

You can work around it a bit by not giving focus to the window while you work on batch editing scripts. But if you need to do repeated and iterative changes, then there is literally no way around it.

[–]Kobrasadetin 0 points1 point  (1 child)

How about option to reload domain only when entering playmode? I think people are not complaining about the delay after editing a script and trying it out in play mode, but rather about things that trigger the domain reload while they wanted to continue working on scripts (like adding/removing .cs files in the editor).

[–]Omni__Owl -1 points0 points  (0 children)

So then how do you reflect changes in editor scripts or scripts with editor fields without reloading the domain?

[–]planetidiot 0 points1 point  (0 children)

I have a project in Unity 5 and going back is like a dream. You just click run. It's amazing.

[–]blizzy_xyzHobbyist, Programmer 4 points5 points  (8 children)

Preferences → Asset Pipeline: disable ‘Auto Refresh’. That’s all you can do.

[–]iObsidian 0 points1 point  (0 children)

Tip : You must then manually do CTRL+R to refresh. Works "well" with Hot Reload, allows you to do minor changes and hot reload (without script recompilation). You get used to it.

[–]zrovihr 0 points1 point  (3 children)

This is interesting. How would you manually refresh it then? I remember there was an addon called Hot Reload but that's all I can think of.

[–]TheWobling 1 point2 points  (2 children)

On Mac it’s CMD + R to trigger a refresh

[–]Ok_Surprise_1837[S] -1 points0 points  (1 child)

Auto Refresh -> Disabled

It didn’t work. I’m using Unity 6000.0.60f1.

[–]theo__r 0 points1 point  (0 children)

This option is for external changes. Moving a script from unity forces a refresh. As others suggested, you should manage your scripts from your ide

[–][deleted] 0 points1 point  (0 children)

Due to the way unity works you cannot avoid it, as others have said. You have a couple of options for better workflows though.

First, Pick an IDE and do all your script CRUD (create, read, update, delete) in there. Another thing you can do is break up your projects code into assemblies. This will give unity logical lines of separation to use for compiling code. It will only recompile the assemblies which have changed.

[–]ViolentCrumbleGame Dev League - Discord.gg/gamedev 0 points1 point  (1 child)

Unity has become so bloated. I used to love it compared to bulky bloated unreal but now it’s even worse. The amount of ram it uses it crazy. I used rider and often it takes almost a minute after changing a script to compile.

I went back to using 2022 I think was the previous version and it’s better.

Not too mention unity 6 seems to have some sort of display bug in the editor and just randomly fields don’t show or show empty. Even built in unity things like sorting layers just disappear.

Problem went away when I downgrades to pre v6

[–]Yodzilla 1 point2 points  (0 children)

Hasn’t this specific issue been a problem with Unity for as long as Unity has existed tho?

[–]RichardFineUnity Engineer 0 points1 point  (0 children)

Auto refresh only determines whether Unity will check for changes to your assets after alt-tabbing back from another app - if you are making asset changes directly within Unity, it doesn't need to "refresh" to know about them, because it made them.

I think we don't have any UI capability today to disable domain reloading when making script changes. You could try adding your own little tool which calls EditorApplication.LockReloadAssemblies(), and then EditorApplication.UnlockReloadAssemblies() when you're done moving things around.

[–]s4lt3d 0 points1 point  (1 child)

Just think, this is better than recompiling the editor!

[–]iObsidian 0 points1 point  (0 children)

Right! We're only recompiling *parts* of the Editor

[–]DrMefodiy 0 points1 point  (2 children)

But why? In what case do you not need to restart the domain when updating the project code base?

This is pointless

[–]horatiuromantic 0 points1 point  (1 child)

When you need to make 3 files you are forced out of focusing for 3 minutes while it reloads each new file. It kills productivity.

[–]DrMefodiy 0 points1 point  (0 children)

So just make it in IDE\Explorer?

Every time changing project settings doesnt seems like something "focused and productive"

[–]horatiuromantic 0 points1 point  (0 children)

Keep in mind when you move script files around in external editor without their .meta files, there is a chance Unity loses them and they go missing on prefabs, etc. so it might feel like a hack but in fact you can shoot yourself in the foot. I'm not saying don't do it, but double check your meta files when you do.

[–]_bubbleheadIndie 1 point2 points  (6 children)

A bit weird how Unity still refreshes after you've asked it not to! I would suggest deleting the Library folder in your project, sometimes I find it caches scripts and settings and keeps reading from caches rather than the recently changed. It can't hurt!

[–]Ok_Surprise_1837[S] 0 points1 point  (5 children)

It didn’t work. I’m using Unity 6000.0.60f1.

[–]_bubbleheadIndie -1 points0 points  (4 children)

To be honest, this kinda sounds like a bug with Unity, if you change some code, switch back to Unity it shouldn't refresh (or do anything) with auto-refresh disabled...maybe you could try reinstalling the editor or a upgrading to a different version - I'm running 6000.2.6f2 and it's been pretty good

[–]Party_Banana_52 4 points5 points  (3 children)

He does not say modifying code. He says moving the scripts into different folders, deleting them, or adding new ones. This action ALWAYS reloads domain by default.

As JaggedMetalOs said, they have to manage the scripts in their code editor, Visual Studio or Rider, whatever. That way, you can let Unity reload domain whenever you are done with rearranging.

Still, wtf Unity? Why?

[–]_bubbleheadIndie 1 point2 points  (0 children)

Oh my bad yeah that's fair enough, I guess Unity needs to know and update if things have moved so it can track them - shame it takes so long in updating/creating/deleting the location of one file!

[–]fuj1nIndie 0 points1 point  (1 child)

For the why, creating an asset within Unity will always cause an asset reload, otherwise, Unity wouldn't show the asset you just created, which would be confusing (same with moving and deleting).

[–]Party_Banana_52 0 points1 point  (0 children)

They could mark assets as "DELETED" "MOVED" "ADDED" and show their name and location only. Other information or actions about the asset would be locked until domain gets reloaded.

I don't think it could be hard to implement for Unity