Whenever I make and save changes in my c# scripts, unity should recompile for a few seconds and then adapt the changes into the project. But for me this doesnt work, when I’m in Play Mode, only in edit mode.
Which is not normal. Only when clicking on Stop and I am back in edit mode, it all of a sudden recompiles the scripts. But that would slow down developement dramatically.
I have “Recomplie and Continue Playing” turned on in General settings. Auto Refresh is also turned on under Asset Pipeline.
If i change “Recomplie and Continue Playing” to “Stop playing and Recompile”, it actually stops whenever i make changes and recompiles as it should. But never during play mode.
I tried it on unity 6.0 and 6.6, other projects, reinstalled the editor, nothing helps.
And yes i am sure the script actually changes when i edit it in Visual studio. When clicking on the script, the Inspector in Unity shows me a little preview of the code, and the changes can be seen there, but they aren’t applied, cause IT DOESN’T RECOMPILE for some reason.
It’ strange, I haven’t found ANYONE with the same problem so far.
Please, I need help
I believe others will confirm that isn’t unusual or unexpected. I will admit to never having tried it but in a realistically complex project arbitrary changes to scripts can cause all sorts of code branches to be changed. The scene you are on doesn’t even have to exist, properties could have been removed.
I personally wouldn’t rely on what I saw in such a case as being representative of simply stopping, recompiling and starting again.
Probably because nobody really uses the feature, as it’s really hard to write code so it works But if you have Recompile and Continue Playing turned on, and it doesn’t do that, then that’s a bug and you should report it with the bug reporter.
What happens if you try to refresh manually, using assets->refresh or ctrl+r? That could be a workaround.
It doesn’t. Not with FEPM (fast enter play mode) enabled, which Unity 6.6 makes the default setting.
Then it will prevent a host of issues. For instance you may be hunting a ghost bug that ONLY occured because you had scripts recompile during playmode. Or the opposite: everything works fine, perfect even. And then you exit and enter playmode again and it’s broken. It is next to impossible to make playmode recompile work correctly for anything but an isolated test scene due to all the state that remains (or doesn’t).
HotReload has also been mentioned, which I would recommend, but I also hate it for being one of those tools which doesn’t work in every situation due to technical reasons. So it’s always a surprise when a change for some reason cannot be recompiled in playmode.
just remember that when you hit some strange bug, where something isn’t working like it should be,
then disable hotreload or press the manual refresh and try again!