During game development process in Unity we are writing scripts. For convenience we usually use any integrated development environment (IDE). By default Unity provides MonoDevelop IDE. Do game developers have any other options to choice? Yes, they do. They can start using Microsoft's Visual Studio as an IDE to cope with scripting experience.
How to setup
Currently, the integration of Visual Studio with Unity is easier than ever. You can simply install Visual Studio during Unity installation. In Choose Components section make sure that Microsoft Visual Studio Community 2017 option is checked.
After installation, all C# scripts should open in Visual Studio. However if they still opening in MonoDevelop, you should setup Visual Studio manually. Go to Edit/Preferences/External Tools then from External Script Editor choose Visual Studio 2017 option.
Now you can start work with Visual Studio IDE.
License and pricing
The Unity provides free Community version of Visual Studio. Any individual developer can use this version to create their own free or paid apps. Community version can also be used:
- in classroom learning environment
- for academic researches
- for contributing to open source projects
- or even in non-enterprise organizations, up to five users.
Beyond that, company have to buy one of following license:
- Professional - for smaller teams ($539/yr or $45/mo - per user)
- Enterprise - for enterprise organizations ($2,999/yr or $250/mo - per user)
Visual Studio Tools for Unity
Visual Studio Tools for Unity (VSTU) is a special plugin which enchances your productivity. It provides features which make work with code more easier. Visual Studio 2017 includes VSTU built-in so we don't have to install any extra plugins.
The most interesting features provided by VSTU:
- the Unity Project Explorer which displays Unity project in the same way like in the Unity editor
- Unity console integration - you can check Unity console output without leaving Visual Studio
- Syntax coloring for the Unity's ShaderLab language - easier shaders writing
- Unity behaviours browser - press CTRL + SHIFT + M to select methods to insert from list.
- MonoBehaviour wizard - allows to quick insert Unity's code templates (e.g. Update() method). Press CTRL + SHIFT + Q
- Access Unity documentation from Visual Studio - highlight the API call you want to learn about, then press CTRL + ALT + M, CTRL + H
- and my favourite...
Yes, you can debug C# scripts and DLLs regardless of whether it's running in the Unity editor or standalone. Debugger provides features:
- breakpoints (including conditional breakpoints)
- inspection and modification of the values of variables and arguments
- evaluation of complex expressions in the Watch window
- ability to dive into complex objects and data structures.