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.
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.
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:
Beyond that, company have to buy one of following license:
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:
Yes, you can debug C# scripts and DLLs regardless of whether it’s running in the Unity editor or standalone. Debugger provides features:
Firstly you need to attach Unity Debugger. In Visual Studio select Debug/Attach Unity Debugger, then select current Unity instance or input IP to connect remote.
Next click OK and your debugger is ready to go. That’s it. However in purpose to see any effect of debugging you need to add at least one breakpoint in your code. To add breakpoint click on the left side of line that you want to stop execution on it. Red dot should appear.
Now when execution met this line, game will pause and then you can start debugging of your code. By hovering mouse cursor on variable you can inspect it values.
Visual Studio is a powerful masterpiece produced by Microsoft. Integration with Unity is very easy and list of pros is long. From benefits from Visual Studio Tools for Unity, throughout IntelliSense with MonoBehaviour API, integration of version control systems and many, many more. What is more Visual Studio IDE is available for both OSes: Windows and macOS.
If you don’t use Visual Studio, it’s appropriate time to start! It’s really worth it!
To help us create more free stuff, consider leaving a donation through Patreon where you can vote for the next asset pack and get access to future packs & articles earlier. Sharing knowledge is our passion. Unfortunately, keeping a team of professionals costs a lot that’s why we are constantly taking on new opportunities.
We’ll be publishing any news on the following outlets:
Thanks for reading!