“Recompile After Finished Playing” option is missing (or better say removed)

Hi,
I switched from Unity3d 2019.4 to 2021.3.9f and found that the "Recompile after finished playing" feature has been removed from the editor.

8436200--1117493--2022-09-10 13_42_07-Preferences.png

Without this "Compile after playing" feature our iteration times will increase by a lot. It was one of the best features added in the past and decreased our iteration times big times! I assumed this to be a bug and searched for it and then found the issue in the bug tracker:

Link

Now maybe I didn't get it, but the recommended "solution" is not working the same as before, so I wonder if someone can explain to me how I can get the old behaviour again?

"This features has been depricated due to it not working as intented. It has been replaced with a new auto refresh feature in Preferences -> Asserts Pipeline -> Enabled Outside Playmode" When activating the "Enabled outside playmode", my scripts aren't compiled at all anymore.

I later found this entry by @castor76 which makes way more sense:

"... what we really want is to have option to have "only" scripts to be auto refreshed outside playmode, but not the all other assets..."

Yes, that would make sense. If I change a script, I want to recompile. If I change a 2 gig Photoshop file, I may not want to reimport it immediately.

Unfortunately I can't figure out how to add a poll here as I'm interested if we're the only ones who miss the feature.

Thanks for feedback,
Patrick

9 Likes

Can you explain the workflow where the iteration time has decreased. E.g. are you changing code, artwork, pulling from repo or something else?

Hey.
While implementing and testing, we start the Playmode, test features,... During that, we adjust several times our scripts, debug outputs, calculations on the fly. With "Recompile after finish playing" that was no problem, as the changes would take effect after we ended the Playmode.

Now with that gone, if I change my code and go back to the Playmode, the Editor will recompile and kick all static references (e.g. singletons) and continues playing in a different state than before. That means I have to stop the editor (throws null refs anyway now) and can't continue with my test session.

It's about script changes, either from my custom DLL I import and scripts direct in the Unity project. Graphics are not an issue for us in that regard.

If this should work, as mentioned in the first issue tracker description, I have not gotten it to work like that.

Thx for the help!

3 Likes

To be sure I understand: You change code related to you project outside Unity. And then you go back into Unity to test whatever is currently runnning in playmode, but don't want any recompile or imports to happen?

1 Like

Yes. The recompilation (~~at least in the past~~ is still the case) removed static variables (for example singletons) assignments. It's quite easy to reproduce:

I attached 2 scripts, create a scene like this:

8439233--1118258--2022-09-14 14_59_15-Unity_Client - test - Nintendo Switch - Unity 2021.3.9f1 _DX11_.png

Attach scripts accordingly.

Run playmode and change the Debug.Log message, so when coming back, the Compiler will run, remove your static instance reference and you'll get only Null Refs in the log anymore from the MyUpdate Updatemethod.

For us it's quite normal to change the code at some points, test even further (especially when you have a very complicated test case and you don't want to interrupt 'cause you found a typo in a debug message) and when the test is complete, you stop and then compilation takes place.

Hope this makes sense?

8439233--1118252--MySingleton.cs (224 Bytes)
8439233--1118255--MyUpdate.cs (373 Bytes)

2 Likes

That makes sense. The new way to support this workflow is to change the way autorefresh is enabled.
With the update that removed the "Recompile after finished playing" another option was added to the autorefresh setting. So instead of the autorefresh setting in the preferences being just a disabled/enabled option, there are now 3 options: Disabled, Enabled and EnabledOutsidePlaymode. Selecting the last option will make sure that auto refresh is not done during playmode. So you can go to your code and make fixes, and then return to unity without any compilations happening and continue your testing.

Does this help?

2 Likes

[quote=“jdrewsen”, post:6, topic: 894122]
T Selecting the last option will make sure that auto refresh is not done during playmode. So you can go to your code and make fixes, and then return to unity without any compilations happening and continue your testing.

Does this help?
[/quote]

Ok, thanks, I’ll give it another try. When I used that option, I always had to trigger compilation manually then (reimport on one of the script files), there was no automatic script update and recompilation, like it was before, where compilation was happening when I left the play mode.

Ok, I gave it another try and it's not working.

What "EnabledOutsidePlaymode" simply does is ignoring my changes of my scripts, I do during playmode. I have to recompile manually.

@jdrewsen Did you get the same behaviour as before, when applying these adjustments to the editor?

4 Likes

Another pretty annoying thing: the "Script Changes while Playing" setting is across all editors. So, everytime I open my 2021.3.9f1 project and switch back to my former projects, I have to change the setting again to "Recompile after finished playing".

5 Likes

[quote=“pahe”, post:8, topic: 894122]
What “EnabledOutsidePlaymode” simply does is ignoring my changes of my scripts, I do during playmode. I have to recompile manually.
[/quote]
Ok… what if you simply refresh manually once out of play mode (e.g. ctrl+r). Doesn’t that recompile?

[quote=“pahe”, post:9, topic: 894122]
Another pretty annoying thing: the “Script Changes while Playing” setting is across all editors
[/quote]
Yes I can see that is not good… noted.

[quote=“jdrewsen”, post:10, topic: 894122]
Ok… what if you simply refresh manually once out of play mode (e.g. ctrl+r). Doesn’t that recompile?
[/quote]

Yes, that triggers the recompile as well then. Same when I manually recompile.

[quote=“pahe”, post:12, topic: 894122]
Yes, that triggers the recompile as well then. Same when I manually recompile.
[/quote]
Very well. Seems like we are not kicking off the the delayed refresh when EnabledOutsidePlaymode is set. I’ll make a bug report on that. Thanks for the feedback!

4 Likes

So from my experience in 2021.3.10f1 the recompilation on these settings triggers when some scripts change, but only if the changes were made while not in play mode. Changes in play mode are ignored (as they should) but also not recompiled after play mode has finished. If you then make more changes while not in play mode everything recompiles again.

Furthermore, changing the Auto Refresh setting only seems to apply after restarting Unity, which should be shown as an info when changing that setting, similar to how it is on other settings

And another bug, if you have made changes to the script while in play mode, and then (still in play mode) delete an asset (possibly also when doing other asset operations), the scripts are reloaded and thus, stuff breaks because of the reasons stated above.

1 Like

[quote=“l-mueller-stoehr-sauer”, post:14, topic: 894122]
Changes in play mode are ignored (as they should) but also not recompiled after play mode has finished
[/quote]
Yes, same as @pahe experiences it seems.

I came looking for others experiencing this issue and just wanted to add a +1 to the original post.

The new auto-refresh option is OK, but still not ideal. There are times when I would want to reimport assets (such as art/audio) but NOT recompile code changes, and may need to reimport one but not the other. In fact, I never want to recompile code during play mode. My personal workflow is to always restart play mode after recompile.

For what it's worth, if we have to direct this choice through the new Auto Refresh option then my ideal solution would be to have the existing auto-refresh option for assets, and then have an additional option for code changes.

Something like:

  • Auto Refresh (same as current dropdown option)
  • Prevent Recompile During Play Mode (TRUE/FALSE)

But to be honest, I'd much rather have just kept the original "Script Changes While Playing" option determine this because it's worked that way as long as I can recall and it lead to much confusion when it quietly changed.

12 Likes

I just noticed this and posted on Twitter, and saw this thread after a search there: https://twitter.com/mwegner/status/1575940849795334144

Please, please return this feature. I don't understand why it would be removed at all.

Furthermore, I don't understand which projects are even capable of surviving a recompile while in play mode. I've asked around over the years, and I've never found a single project that is compatible with it, let alone uses it as a fixture of their workflow. Is this for some non-game use (configurable customizer or something)?

I've been using Unity since the 1.x days, and past a very early prototype project with maybe a scene or two, something breaks during a hot recompile. I get that it's a complex feature, but don't remove an actually-useful feature because it makes that complexity worse.

The options we have now are:

  • Stop playing anyway, because there's a 0% chance anything will survive recompile and keep working
  • Stop

Or, change a global option to stop importing any new assets without a manual refresh? Ugh

I haven't posted here since 2018, but I bothered to post this. I just thought it's been buggy, since I lose an editor session a couple times a day due to this, but I finally checked settings today. Absolutely maddening to hear that it was both deliberate and being defended

22 Likes

Just want to +1 the original post because this is extremely important and really degrades the development process.

Its quite common for me to make code changes while testing, and to want to continue testing. Say for example I am testing a gameplay sequence which takes 30+ minutes and find a small issue. Currently I would just make that code change, and continue testing. Its not acceptable to me to have to restart testing.

Disabling auto-refresh is not a solution, because for every single asset except code, I always want these to update. I regularly make changes to textures, shaders, audio and models while testing, and having to manually refresh now is just silly.

To +1 Matthews comment, I have also never seen a non-trivial project which could survive hot recompiles.

8 Likes

Why on Earth did Unity remove that feature? I often make several changes while in play mode so they get all batched for a single recompile the next time I stop and re-enter play mode.

It's also super useful being able to make changes to things like shaders and textures during play mode and see the changes in the context of the game, so losing that ability just to keep Unity from blowing into a million NREs due to a mid-playmode domain reload clearing all statics and stopping all coroutine/async operations is not ideal at all.

If only there were people inside Unity that actually used Unity for making games those sort of usability blunders wouldn't happen as often as they do.

And since 2021 has gone LTS and with 2022 nearing LTS status, if the feature comes back it will likely only happen in 2023, meaning two entire LTS cycles having to manually refresh assets to recompile our scripts.

This reminds me of when Unity decided to remove Mono support for consoles during most of the 2018 cycle, but only shipped IL2CPP script debugging in unity 2019. Meaning the only way to debug anything on consoles in Unity 2018 was printing to the log output and guessing where exceptions were thrown from since there are no C# line numbers in IL2CPP (that's supposed to be coming in 2023 or something).

10 Likes