Last updated January 2020, 7 min. read

Tips to optimize your Visual Studio tools when coding in Unity

What you will get from this page: Handy tips to help you be more productive when using Microsoft Visual Studio or Visual Studio for Mac as the code editor for your Unity projects. Visual Studio and Visual Studio for Mac come with a suite of tools for Unity, including IntelliSense support for Unity API messages, debugging and inspecting features, the Unity Project Explorer, and Attach and Play. Thanks to John Miller from Microsoft who provided these tips in his Unite Copenhagen session.

Update Visual Studio

This is an obvious but important reminder that you can update Microsoft Visual Studio independently of the version of Unity you’re on, without breaking things in your project. The latest version of Visual Studio always provides performance improvements on both Windows and Mac that save you valuable time. It's super simple to update; you can see how it’s done in this image.

Leave Visual Studio open

You can avoid costly delays that come with cold launching Visual Studio by simply leaving the editor open. It will continue to synchronize your changes as you operate back and forth between Visual Studio and the Unity Editor

Reduce load time

You can save some loading time by unchecking the box “Restore Solution Explorer project hierarchy state on solution load.” However, if you want to expand all your folders when you launch your solutions so as to write to the file you had open the last time, then don't uncheck this box.

Save time with keyboard shortcuts

Use CTRL+T (Windows) Shift+CMD+F (Mac) to search your entire project for anything. 

Work faster with Unity APIs

You can access Unity documentation directly from within the Visual Studio editor on Windows and Mac. To do so, highlight the Unity function you want to know more about. Then you can either go to Help > Unity API Reference or use keyboard shortcuts Ctrl+Alt+M, Ctrl+H or Cmd+' to launch your browser either inside the integrated development environment (IDE) or externally. 

If you have a long file with a lot of code, it can be super helpful to customize the fonts and colors of Unity API methods for quick identification.

Debug your Unity code faster with Attach and Play from Visual Studio

Debug faster with Attach and Play

Instead of clicking Attach to Unity and then switching to Unity to press Play, you can use the Attach to Unity and Play configuration to make it a one-step operation. This will attach the debugger and play Unity; you don’t have to leave the IDE, thereby speeding up your debugging workflow.

Use IntelliCode

IntelliCode is the AI-powered and machine learning model for improving IntelliSense. Intellicode saves you time by listing auto completion suggestions in an order based on what you’re most likely to use. To use it, open a project in Visual Studio, open Intellicode, and choose the option “Train Intellicode” (in VS 2019; in VS 2017, IntelliCode is a separate extension that can be installed from the Visual Studio Marketplace). It will then generate a model based on the open project; using those learnings it can provide suggestions for other projects. In his session, John talks about how he used the Unity FPS sample project to show what’s possible with IntelliCode.

Collaborate with ease with Visual Studio Live Share

Collaborate better with Live Share

This last tip is a good one for collaboration. Click “Live Share” to generate a link to parts of your code that you can then share with anyone that has Visual Studio or Visual Studio Code installed. A sharing session is created between you and your collaborators, allowing them to see your code without having to install anything except for the editor. 

Did you like this content?

We use cookies to ensure that we give you the best experience on our website. Visit our cookie policy page for more information.

Got it