Unity Stuck on Application.UpdateScene - c#

My game was working fine all long for days. Recently just after adding attack animation for my enemyai it started freezing everytime I clicked on play.
So when I click play unity pops up with a message saying "Hold On ! Application.UpdateScene" and its stuck on that ever since. The only way for me to exit is using task manager.
Screenshot:
I tried debbing and adding break points but it did not work. At this point I don't know what wrong is it my code or something else.
I haven't updated my unity I am on 2020.1f but I don't think that might be causing the problem.
Also incase it's not possible to resolve this problem can you'll please tell me a way to complete my project quicker without redoing it everything.
Thanks

It is usually caused by a dead-loop.
I also has this issue today. I solved it by attaching the debugger (Visual Studio in my case) to the forever loading Unity Editor. After that, pause the debugger. This will freeze Unity but we can then inspect where the code is executing at this particular moment. Select the inspecting thread to "Unity Thread" in Visual Studio. In my case, it immediately show the code is running inside a while-loop which I forgot to increase the i variable and turn the loop into a dead loop.

The reason is just delete your Library package in your project folder then reopen your project unity recreate the file. The problem appears when you import assets from asset store.

Related

Duplicate keystrokes on cshtml editor

I'm having a strange problem in Visual Studio 2022, and would like to know if someone else faced it.
It only happens when editting .cshtml files, on Asp.net MVC projects, ocasionally when I press a key on the keyboard, the editor insert that same letter 2, sometimes 4 times. I need to restart my machine to solve it, but it will eventually return. The image bellow ilustrate the problem, I've typed <div> and got this result:
It doesn't happen on .cs, .js files, or in any other editor in my machine.
You most likely have GitHub Copilot activated. If so, try deactivating it.
I was going nuts with this too, until I found out that it was GitHub Copilot that was doing it once in a while. I have not found a solution to it, other than deactivating Copilot.
You can see a thread on it here: https://github.com/github-community/community/discussions/14206
Boa sorte ;-)

What is responsible for pausing code in Unity?

There's something that's pausing my code in Unity and I'm not sure what it is. I've searched for Debug.Break() statements everywhere and don't have any. What's causing this issue?
(Asked on behalf of Jabrils who could have been saved by this question.)
If you don't have any Debug.Break() statements, and your code doesn't have any other breakpoints to look at, check the "Pause on Error" functionality of Unity. It can be turned off by clicking a UI button when you have the console open.

Failed To Create Agent after Build Game - Unity

My game is running normally in the runtime editor. The problem occurs with the build result. seen in the Output Log that the agent (NavMeshAgent) was not created because it did not close enough to navmesh. whereas in the editor the problem did not arise. Next I attach a screenshot of my output log.
Maybe someone knows why this happens? and what is the solution ??

XNA does not respond to changes in code

Most simply explained, when I edit, delete, or add code into my XNA project, it does not respond. This is to say that I can comment out the entire Update method of my game and it will run as usual. This also means that the game is stuck at a certain time in development, and can not be edited. I've tried reopening my project and it does not help. I've had this problem before and it is incredibly infuriating and frustrating.
http://puu.sh/1kD6P
This is an image where I have commented out the Update method and would normally never be able to run with 66 errors. But it does run.
In the past I have had to create new projects and drag all of my art assets over and copies of the code. That is the only way I know to fix it, but this has happened with every one of my projects (even on a different computer before).
Anybody know what's going on?
Have you tried rebuilding it from the build menu, not just clicking the debug button?

Visual Studio is missing/moving my breakpoints

The problem is that when I place a breakpoint and debug/run, the breakpoint moves by itself.
Before/whilst coding:
After clicking run/breakpoint hit:
Breakpoints typically work ok for me, but it seems that they sometimes randomly play up. I first had this ages ago with a VB project, and in the end, I bypassed the problem by removing the breakpoint and adding it somewhere else where it was still useful.
Whilst I could probably do the same again, and this is only the second time it has happened (that I remember), I don't really want to have to and would like to know what is actually wrong.
I have read through many similar questions here, but I cannot see an exact match and the answers do not help. I have tried - building, rebuilding, closing/reopening and cleaning.
I only provided a picture of the bit of code where it occurs, if you need anything else, please let me know.
It's because the debugger isn't able to break at that point. For example, the debugger can't break on auto-implemented properties, or at the header of a method; instead, it breaks at the first line of the method.
Also check to see if you had set the breakpoints in one mode (Debug) but are now in a different mode (like Release). This caused me some momentary angst.
I got this problem after Windows had inexplicably added 6 months to the current system date (and 1 hour to the time). I didn't correct this right away, so builds made before the correction looked more recent to Visual. This lead to running the wrong (older) build when debugging.
Since I couldn't find a "Clean Solution/Project" option, I had to manually delete all .pdb files in the solution. The problem was instantly fixed. I just hope there aren't any more files I might need to delete (I'm new to Visual and don't know much about how it works behind the scenes).
You can get this if the breakpoint is AFTER a return statement. Visual Studio will bounce the breakpoint to the closing brace (or "End Function" for VB.NET) because return is jumping out of the function.

Categories