I have been using Unity since 2014. I never encountered this issue.
While working, making code changes, saving and coming back to Unity more often I get application.reload message box which is fine as long as it goes away, it remains forever till I end task Unity in Windows using the task manager.
The earlier experience was so much better.
Moreover, many other message boxes keep coming like refreshing scenes etc sometimes even when the play mode is on and for a few seconds they appear and go away.
Application.reload causes a major issue while debugging.
How to reproduce:
Star debug mode.
Start going through the lines step by step
For some reason you want to go back to Unity to check visual states of any game objects you are stuck application. reload appears and you have to stop the debugger. Hence I can no longer debug now.
The application.reload sometimes appear while hitting play mode and this is more dangerous it never goes away till I end task as I said earlier.
I am clueless. Is this a bug or some setting which I need to take care of?
I have already disabled Auto-refresh in preferences settings.
Iâm not entirely sure I am following your reproduction description entirely. Does this mean that you have an IDE (e.g. Visual Studio or Rider) attached to the Editor and the code execution paused for debugging (stepping through the code line by line) when you tab back into Unity, and thatâs when the Editor is frozen?
If that is the case, than thatâs how itâs always been (nothing new with the Progress bar popup) and Iâm not sure how it should behave any different. Youâd need to press âcontinueâ or stop debugging (red rectangular button in the IDE) to allow the code execution to resume.
There is no breakpoint I am sure. To me this is an issue linked with a larger issue of resetting static variables [Domain reload]. Irrespective of the domain reload being enabled or disabled every now and then when I make a code change and run, the application.reload appears and everything is freezed, till I end task and restart Unity, make a code change, test - freeze- end task - restart Unity.
I need to reset static vars using the RuntimeInitializeOnLoadMethod, My only problem is I have quite a few static vars and the 3rd party framework I am using has quite a few too. Should I be using this method to find each and every static var and reset?
If you want to bring down your Enter Play mode times, this might be a worthwhile thing to try.
However, if the Editor just entirely locks up on entering playmode (and not because you have your IDE attached), I think youâd be best advised to file a bug report, because that sounds like something is majorly broken.
Just to be sure before I raise the bug, can you please elaborate what you mean by âyou have your IDe attachedâ.
What I can definitely tell you is the Unity editor freezes with application.reload popup infinitely till I end task. Even when I have not attached any debugger or even when I am not in debug mode.
Yes. I just meant if you have instructed Rider or Visual Studio, or VS Code (or whatever other IDE you are using) to attach to the running editor. If you want to be absolutely sure you do not have your IDE attached, close the IDE and end its tasks.
I did what you said and I see no different results.
I have started a brand new project in Unity now and using the same 3rd party frameworks.
The frameworks create voice and video sharing sessions, When I start a session and during testing, if the session doesnât get closed properly because I am still developing, Unity editor freezes again and I have to end task and restart.
So which means its definitely to do with static vars resetting, my only concern is Unity should be resetting those once I hit stop play button in the editor.
Not sure why Unity is unable to do it.
Hence now during development, I have added a button to close the session forcefully, whenever I close the session before stopping play in editor everything is bliss. If by any chance I stop play without closing the session the same error.
I am detailing it out so that it helps you. Really appreciate your time.
Could it be that this framework is hogging some System resources like camera and mic when it isnât shutdown properly? Or does it start up some side processes? With these extra details it feels to me like it could be due to something like that and I can imagine some weird constellations there to cause Unityâs Mono VM to be unable to cleanly reload the domain.
It might still be worth trying to file a bug report but it may also be interesting to simultaneously file one with that 3rd party Plugin.
Bump, this started occurring around the same time as the poster, currently 2020.2.2f1 and Rider 2020.3
When switching Unity to debug mode, then within Rider, attach the debugger to the editor. Now go back to Unity and enter play mode. It will sit at âApplication.Reloadâ indefinitely. This happens across multiple unity projects and even new blank projects.
I donât know if it is a Rider issue or a Unity issue, or possibly a PC configuration issue (similar to how Unity fails to run or has trouble compiling code & shaders if connected to a VPN, though in this case I am not).
It seemed to show up in the late 2020.1 or early 2020.2 cycle
I too see this problem constantly over the last few months ( currently using 2020.1.15f1 ). Constant meaning more than 90% of the time I attempt to debug a script
Attaching visual studio 2019 to unity to debug, with 0 or more breakpoints, results in unity hanging indefinitely after pressing the play button, until I press stop and detach the VS2019 debugger, at which point unity then launches the game, or starts responding again.
The âhold onâ message that is busy indefinitely is one of the three below:
EditorApplication.playModeStateChanged
Application.Message
Application.Reload
Occasionally, i also see no âhold onâ message, and unity just becomes unresponsive - this happens after a few failed attempts to attach the debugger and launch the game, and quite often when attempting to attach to an already running game in editor. The only remedy to this is to shutdown / restart unity & VS2019, at which point the issue returns to indefinitely hanging on the âhold onâ messages.
In all cases, i see high CPU usage in unity and visual studio 2019, and letting it work for several minutes doesnt appear to improve the situation.
Also seeing this with 2019.4 versions of unity and 2018.3.5 version of Rider. I was thinking it was maybe the Rider Plugin being so old, but today I upgraded Rider to the latest version (2021.1) and Unity is 2020.3.2f and the problem is worse than ever.