[The following article was written by Unity technical evangelist Josh Naylor.]
It’s long been a pain point when developing a Unity game: having to use MonoDevelop as the IDE. Originally I never thought it was that bad, but after using Unity VS with Visual Studio on my Desktop Windows PC, I realised it really is much greener on the other side.
However, there’s one problem: I needed a Mac for work to support multiple platforms for demonstrations and to help developers with iOS games, and I didn’t fancy booting into parallels every time just to use Visual Studio for everyday development.
Other packages such as Sublime are great but they lack IntelliSense – auto-completion – which for me really speeds up development time, especially when coding/demoing live in front of 100 people. I don’t want to be stuck missing a capitalisation of some random rigid body for someone to have to point it out.
Anyway, I no longer have to endure MonoDevelop nor do I have to jump onto my desktop or parallels because Visual Studio Code is here. It’s a lightweight version of the full Visual Studio with IntelliSense, debugging and Git integration, and it’s available for PC, Mac and Linux. Wowzers, right?
It’s also pretty damn sexy, with a similar style to Sublime.
For some reason, on the VS Code website it says it’s for node.js and asp.net development – nothing about C# or integration with Unity. Which led a lot of people to ask: “When will it be integrated with Unity?” Well, great news: it already is.
I posted a few screenshots the day it was released on Twitter and the Unity3D sub-reddit and had a lot of responses asking how to do it, so here how you get it running:
1. Open Visual Studio Code
You can use VS code as a text editor – just as you would Sublime, Notepad, Notepad++ – by simply opening a .cs file for quick and easy editing, but I want to set it up with my full solution.
2. Open your Unity Project
You need to select the base project folder, just like you do when opening a full Unity project.
3. Select the correct Project
Your project will be in VS Code but you need to connect the correct solution file. On the bottom left, it’ll show you how many different projects are available. You need the one that has “nameOfProject”-csharp.sln, rather than the one that shows “nameOfProject”.sln.
4. Code and be happy
Locate your scripts and open one up. You should now have full auto completion, just like using Visual Studio or MonoDevelop. Good luck working on your projects.
5. Make it default
Set Visual Studio Code as the default IDE in Unity.
A FEW NOTES
- Mono runtime may need updating to get everything to work.
- There’s no debugging yet for Unity, but hopefully that will be coming soon.
- This is still in 0.1.0 preview mode so many things might change; I’d love to be even more tightly packed with Unity.
- There are already packages on Github to extend VS code functionality with Unity but I’ve not tried them yet. Check them out for yourselves: