Can't debug windows player

I want to debug a built .exe project but breakpoints are not hit.

Unity version: 5.4.2f2
VSTU version:2.8.2.0 (latest)
Visual studio: 2015 Update 3
Windows 10 x64

Here are the build settings:
2935602--217122--upload_2017-1-26_11-20-15.png
I did with x86_64 too. No difference.

A .pdb file is created for the player. I deleted it and after build it is created again so seems right.
2935602--217123--upload_2017-1-26_11-22-6.png

When I execute 1.exe I go to DEBUG>Attach to process… and choose the 1.exe process, Then I click on ATTACH.

This is what happens:


The breakpoints are simply disregarded by VS. Also if you carefully take a look, I do a lot of #if UNITY_EDITOR for portions that should be excluded from build. This does not seem to be the reason because the same problem seem to exist in files that do not have this directive. Also if you look at the modules window in the screenshot it is evident that the .pdb file is actually loaded.

Another thing I’ve done is in the DEBUG>Attach to process… dialog I clicked on the SELECT button and chose Unity code. It made the breakpoints solid red again and the warnings went away. But the breakpoints are still not triggered even on codes that don’t have any compiler directives.

I also did reboot the computer:p. The project can be debugged without problem when run in editor. Only built player has this problem.

So I’m out of clue right now. Is there anything else worth of a try?

Ok. Created a new project with a simple MonoBehaviour. Same thing happens.
2935616--217126--upload_2017-1-26_11-55-26.png

Try doing debug>attach to unity process in visual studio. You should then be able to select the unity Windows Player or unity editor. If unity windows player isn’t working make sure that under File> build settings: development build, script debugging and wait for managed debugger are all checked. The last ensures a dialogue box appears after you run the 1.exe for when you can do the debug>attach to unity process step in visual studio. This fixed the problem with the breakpoints not being hit for me.

1 Like