I am trying to debug a coroutine in Unity using VS2017.
When I attach VS to Unity and set a breakpoint inside the IEnumerator
method I get the error "Breakpoint will not be hit"
It is discussed in depth here: How do I remedy the "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?
However none of those answers worked for me.
Do you know how to set a breakpoint inside an IEnumerator in VS2017?
Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All , use Debug > Windows > Modules . You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
This is known bug in Unity. Here is how to fix this:
1.Go to File --> Build Settings... then select your platform.
2.Click on Player Settings --> Other Settings and change the API Compatibility Level to .NET 2.0.
If it is already set to .NET 2.0, change it to .NET 2.0 Subset then back to .NET 2.0.
3.Close and re-open Visual Studio. From Visual Studio, go to Build --> Clean Solution then Build --> Rebuild Solution.
Try debugging again and it should work.
If the steps above did not work, Go your Project's Library folder then deltete it. Restart both Unity and Visual Studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With