简体   繁体   中英

The breakpoint will not currently be hit. No symbols have been loaded for this document in Unity

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?

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.

In my case, this happened when this script was not attached to anything in the scene, therefore, the breakpoint would never be hit... something unexpected from somebody who works in C++. This is a nice side effect, though.

In my case it was because I was using "Attach to process" instead of "Attach to Unity ...". The latter was not available, because the Unity addon for VS failed to install.

I had the same issue. Following steps solved mine.

  1. Navigate to build->configuration manager .

  2. check for project configuration. If it is set to production , change this value to debug .

I spent enough time and found the solution. Go to Build-> Configuration Manager and change Active Solution Configuration to Debug.

So, i had these too The unity doesnt know which script tool you are using..

  1. In Unity, do Edit -> Preferences.

  2. In the Preferences window that opened, choose the External Tools tab.

  3. Click on the External Script Editor dropdown.

  4. Click on Browse.

  5. Select Visual Studio 2017 if not already selected

GoodLuck (;

(:

I found a solution (workaround). You need to add the attribute [InitializeOnLoad] to the class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM