Application reload

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:

  1. Star debug mode.
  2. Start going through the lines step by step
  3. 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.

Please help.

1 Like

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.

Does this also only happen when your IDE is attached? Maybe you have a breakpoint in an Update or similar method?

Thanks MartinTilo for the response.

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.

As per Unity docs https://docs.unity3d.com/Manual/DomainReloading.html

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.

Ok, I will file a bug report.

1 Like

Once you submit a report, please share the issue ID in this thread for easier follow-up.

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

@LeonhardP @MartinTilo

There is also more reports of it here around the same timeframe: Unity editor infinite "Application.Reload" when debugging - Questions & Answers - Unity Discussions

1 Like

@Zaskar7777 do you have an issue ID?

@XRA_1 , might be worth filing a separate bug report, just in case it’s a different underlying root cause (or not yet filed)?

I use Visual Studio 2019 and Unity 2020.2.1f1 and I have this problem quite frequently.

2 Likes

Hi there :slight_smile:
Could you please file a bug report on this?

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.

3 Likes

same here :confused: Unity 2020.3.0f1 with VS 16.9.1

5 Likes

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.

Happens to me too. Hope this gets fixed ASAP. I basically have to restart my PC whenever this happens.

It’s happening to me too. I run the program few times, makes changes in the code and then the Application.Reload starts and never ends.