Simon (darkside) Jackson returns (Recent highlight, Unity with VS Code) today with a great post on how to use VSCode to debug your next Unity 3D project.
I’ve written several articles on the use of VSCode with Unity through its evolution but time and tide waits for no man as the behemoth of technology marches on.
If you’ve not heard of Microsoft’s new multi-platform lightweight code editor before, go and check out its homepage (https://code.visualstudio.com), it’s chock full of fantastic stuff to make you drop MonoDevelop or any other lightweight editor. You can also check out my previous articles here and here.
Microsoft VSCode has taken many great strides since last I donned my writing hat, most notably:
- It’s now completely opensourced! – Check it out on GitHub here (https://github.com/Microsoft/vscode)
- A new extension system has been added, allowing community devs to write plug-ins and language extensions to the editor without rebuilding it
- Debugging support for web apps has improved greatly
- Git and Source control support has been improved
There is a lot more but these are my favorite highlights. If you have read my previous articles on the subject (here and here), you will also know that it has some great support for Unity, which has only gotten better now that Unity themselves have pulled in to the race:
The story so far
Let me stop you there
The train never stops when it comes to technology (even Cobol still lives!, granted Flash and Silverlight are headed to the graveyard), especially when a project becomes opensource but is still heavily contributed by the project originators, which in this case is Microsoft. They are certainly on a mission to make the fastest and most powerful cross platform editor out there.
Recently Unity Technologies themselves also wrote an extension for VSCode to allow debugging of Unity projects from more platforms:
Enough talk, let’s get this up and running in a few short steps, it’s easy enough but the information is slightly scattered throughout the interwebs and pages.
The short path to get this running is as follows:
- Install Unity (but let’s assume you have done this already)
- Install VSCode – download it from http://code.visualstudio.com for your OS
- Open your Unity project
- Download the VSCode asset from dotBunny from the Asset Window (or import the asset if you have downloaded it manually)
If all goes well you should see a new “Launch.json” configuration file in the viewer showing you the current debugging options available.
If anything goes wrong or it doesn’t look right, then simply return to the folder/files view (top left folder icon) and delete the Launch.json file, then repeat the above steps which will recreate it.
You should be able to determine from looking at the default launch configuration that it only supports the Editor by default, however you can extend this to support projects too if you wish, just check the marketplace support page for more detail – https://marketplace.visualstudio.com/items/Unity.unity-debug
All done, if you return to the Folder/File view you can set breakpoints as you would do in any other code debugger and have VSCode break on that line when it’s hit.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.