I hit the green play buttton on VSCode then the Play button on unity
Is there some other function to debug via VS ,I am fairly new to this.
Please help
Im on
OS X 10.11.1
Unity 5.3.1
Mono JIT compiler version 4.2.1
VS Code Version 0.10.6 (0.10.6)
Debug with VS has several features you need to remember:
You can’t debug code that belongs to unity. It starts in it so you can’t use debug before unity’s code gets to your script.
The main point of debugging is place a breakpoint and watch what happens after by stepping by one command(default should be F9 to place/remove breakpoint, F10 and F11 for step over/into unless OS X VS has different keys). More to it: because of point 1 unless you place breakpoint there’s no other way to stop execution. On screenshot I don’t see any breakpoints… Basically. you didn’t tell VS where to stop.
I didn’t try it on OS X and I didn’t try dotBunny, but those are just basics that are applicable everywhere.
To check if it is working:
Run VS. Run Unity. (order doesn’t matter).
Attach VS debug (windows’ F5, don’t know OS X) and Place breakpoint on some instruction(I see only Debug.Log(…) where it can stop - so place it there)
Run unity. Now VS should’ve stopped execution and be on that breakpoint. Unity is ‘frozen’ and not responding and you can see any variables available in that place in code. That’s expected behaviour at least. Then continue or step and be happy. Don’t forget to get debugger to continue after it goes off your code or unity will still be hanging ‘frozen’.
On my windows+unity+unityVS+VS2015 I have problems with console messages sometimes staying in VS when they shouldn’t and not appearing when they should, sometimes they work, sometimes they don’t, so… I guess that’s a bug, but I don’t deem it critical. Breakpoints are better than Debug.Log(…) in all cases except when they don’t work.
Hey, I recently wrote am article on how to attach VSCode debugger to Unity. It’s really easy. You just have to install the Unity Debug extension in VSCode.