handzlikchris/FastScriptReload

[Suggestion] FSR should take full control of Unity's automatic refresh

SamPruden opened this issue · 6 comments

I have auto refresh fully disabled in Unity's settings. However, sometimes Unity will spontaneously reload the domain for no apparent reason. Often it happens the moment I exit play mode after making script changes, but occasionally it happens in other circumstances too. For example, I just exited play mode and everything was fine, then I went to move an object in the scene, and the instant I started moving it a domain reload triggered. I believe I've seen other people on the discord and the Unity forums having similar issues with this Unity feature not working properly. E.g. here, here, and here.

There's suggestion that maybe it relates to some deprecated Unity option, or that Visual Studio Tools for Unity is responsible. It may be fixable by fiddling about, but it's a bad user experience.

We have IsForceLockAssembliesViaCode, but this only applies in play mode. It's also disabled by default, and an obscure setting that most people probably don't see.

If we can find a way for FSR to block auto-compile whenever FSR is active (play mode or edit mode) but to still allow manual CTRL+R refreshes through, that would improve the UX significantly by sidestepping Unity's longstanding bugs which they've demonstrated no interest in fixing. It would also mean that we'd no longer have to tell people to go into preferences and change the refresh settings, as it would be compatible with whatever settings they had.

It would also be nice to decouple auto-refresh settings (which includes all asset types) from auto-compile, which is the only thing one actually wants to disable when using FSR.

Thanks @SamPruden - locking reload in editor mode as well sounds fairly simple.

I'm not sure if we want to go down that route. A lot of support requests are related to people being confused for normal Unity auto-refresh being disabled (even though they had to agree to it intially).

I've found good bunch of people rely on that behaviour, I wouldn't want to confuse them by locking assembly reload in code by default.

Let's keep this one open, maybe some more people will chip in and we can turn that into a feature then once it's fleshed out a bit more.

It also feels that Unity does auto-refresh when it shouldn't - I'm not sure if it's any plugin place to fix that.

I'm not sure if we want to go down that route. A lot of support requests are related to people being confused for normal Unity auto-refresh being disabled (even though they had to agree to it intially).

Are they surprised by code reloading not happening, or is it other assets? If it's the latter, maybe this is an argument in favour of trying to do more fine-grained control in FSR.

It also feels that Unity does auto-refresh when it shouldn't - I'm not sure if it's any plugin place to fix that.

That's completely fair.

If this continues to annoy me I may well try to fix it in my fork for personal use, If so, I'll report back with more detailed thoughts on what options might exist.

So actually someone faces my issue as well. Not sure why but I also had unity starting to reload things on its own on exit play. Which in my case induce some weird scene corruption each time. It's very annoying. Did you got a workaround ?

It did not, but this is actually a better find, Rider, VS and maybe other editor could force unity refresh ; https://forum.unity.com/threads/asset-pipeline-auto-refresh-disabled-not-working.1410015/#post-9906267

image

alright - that's interesting. We couldn't pinpoint what changed it in the past. Could have been that.

There's a setting added already (based on link you've posted I think) that'll prevent assembly reloads.

It's 'Force prevent assembly reload during playmode' in Options -> Reload.

Give it a try, I'll close this one but let me know if that doesn't halp and we'll reopen