All things game development

Published: 2 years ago

Unity + Visual Studio Code. #unitytips

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, but one problem. I needed a Mac for work to support multiple platforms for demonstrations and to help developers with iOS games, I didn’t fancy booting into parallels every just to use Visual Studio for everyday development. Other packages such as Sublime are great but they lack Inelltisense (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 longer have to endure Mono Develop and I no longer 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 website for VS Code 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 it already is, great news, 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, so here it is.

1. Open Visual Studio Code.

You can use VS code as a text editor like 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 not have full auto completion just like using Visual Studio or Monodevelop. Good luck with your projects.

5. Set Visual Studio Code as the default IDE in Unity.

FYI
– Mono runtime may need updating to get everything to work
– No debugging yet for Unity, hopefully 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 packages on github already to extend VS code functionality with Unity but I’ve not tried them yet
– https://gist.github.com/mwegner/86d7d4266089fa5cbe64
– https://github.com/kode80/VSCUnity

Have a Comment?

 

Some HTML is OK