Breakpoints not working
I checked the monodevelopment breakpoints not working post but it was from a number of years ago and about monodevelopment.
I am using VS 2015 and overnight the breakpoints stopped working. I tried closing everything out an restarting the system - didn't help. Tried different versions of VS - didn't help. Tried using monodevelopment - didn't help.
When I put in a breakpoint in VS attach the C# to unity and run the project the breakpoints are just ignored. Don't know if anything else in debug works since I can't stop the program
Anyone know what is going on and how to fix it? Really hard to do debugging without a debugger!
Answer by andycruce · Sep 27, 2017 at 11:57 AM
I have the same problem. I watched the video but it didn't address the problem. Fro some reason something changes in the the VS-Unity connection and instead of a red dot for the breakpoint I get a hollow red/yellow dot. When I highlight it I get the following message:
The breakpoint will not be currently hit. Unable to find corresponding location.
I tried selecting Attach Unity Debugger in the debug dropdown in VS but this didn't work. I have reinstalled Unity and that didn't clear up the problem either. I am using VS 2107.
I've seen other posts describing this problem but no solutions!
Answer by guneyozsan · Nov 08, 2019 at 01:28 PM
It happens to me probably after a non-Monobehavior or an abstract class and/or its file name is renamed within VS, or after some files are renamed from Unity. Usually generic abstract classes cause the problem. I suppose somehow the code sync with Unity breaks.
Close VS.
Delete
Assembly-CSharp.csproj
andAssembly-CSharp-Editor.csproj
in your project folder.Open VS.
Edit:
I believe there are more than one issue that causes the same problem.
In some cases where base class is generic, sometimes I can activate break points if I rename generic base classe and file name to ClassName_1
and ClassName_1.cs
, where the number is the number of generic types by convention (ex: public abstract class ClassName_1<T> : MonoBehavior
)
For anyone that got the same problem. You should also restart Unity3d to regenerate Assembly-CSharp.csproj and Assembly-CSharp-Editor.csproj after you delete them. Just opening VS again will not help. Still this solve the problem.
Answer by liquidbuddha · May 25, 2018 at 08:22 PM
I am also having the same issue. :( VS 7.5.1, Unity 2018.1.0f2. Re-importing all assets seemed to clear up the issue.
I'm constantly having the same/similar issue. Seems like only the breakpoints are hit for code in $$anonymous$$onoBehaviour class files, but not in utility class files (completely ignored). In fact, I can step through into the utility code files from a behavior, but the breakpoints inside the utility class files are completely ignored. Also, System.Diagnostics.Debugger.Break();
is completely ignored, as is Debug.Break()
. I'm not resorting to throwing and catching exceptions in my utility classes in order to debug them, which is getting really annoying. I noticed my code files getting out of sync also, causing code to stop on incorrect lines, or stopping on invalid code frames. It seems like reimporting the script folder within Unity fixes everything - only until I edit the code in VisualStudio and try to launch debugging from VS as well. This setup is not very reliable as my project is growing.
Answer by Flokky_ · Sep 24, 2017 at 10:22 AM
You can try this tutorial: For the MonoDevelop
Or: For the VisualStudio
Answer by ckaith97 · Sep 04, 2020 at 11:36 PM
I had a similar problem, but a different outcome. (In case others are stumbling across this problem today.)
Consider C# classes that use inheritance (with a base class and a child class). If I put a breakpoint in the base class, but the object in the game contains the child class, the execution won't stop at that breakpoint. It runs the code and prints any Debug.Log(...), but doesn't stop at the breakpoint.
Your answer
![](https://koobas.hobune.stream/wayback/20220612135447im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to properly display debug messages on UI 0 Answers
VS Code missing UnityEngine.UI 1 Answer
Help me debug the issue 0 Answers
Modified Save/Load methods not saving properly 1 Answer
Partial Snapshot of Game Screen 0 Answers