Unity Visual Studio For Mac

May 10, 2017  In 2014, we released the first version of the Visual Studio Tools for Unity (VSTU).Since then, we’ve successfully released multiple versions of the Tools for Unity on Windows, but never had the opportunity to bring our tools to Unity developers running macOS. We’ve added support for Visual Studio Code on macOS and Windows. Once it’s selected as your external script editor, Unity will open your scripts directly in Visual Studio Code. And debugging is also possible via the VS Code Unity debugger extension.

  1. Visual Studio For Mac Os X
  2. Visual Studio Tools For Unity
  3. Unity Visual Studio For Mac
  4. Unity Visual Studio Setup
-->

This section explains how to get started using Visual Studio for Mac Tools for Unity.

Install Visual Studio for Mac

Unity Bundled Installation

Starting with Unity 2018.1, Visual Studio for Mac is the default C# integrated development environment (IDE) for Unity, and is included in the Unity Download Assistant as well as the Unity Hub installation tool. Download Unity from store.unity.com.

During installation, ensure that Visual Studio for Mac is checked in the list of components to install with Unity:

Unity Hub

Unity Download Assistant

Visual Studio For Mac Os X

Code

Check for Updates to Visual Studio for Mac

Unity Visual Studio For Mac

The version of Visual Studio for Mac included with the Unity installation may not be the latest. It is recommended to check for updates to ensure you have access to the latest tools and features.

Visual

Manual installation

If you already have Unity 5.6.1 or above, but don't have Visual Studio for Mac, you can install Visual Studio for Mac manually. All editions of Visual Studio for Mac are bundled with Visual Studio for Mac Tools for Unity, including the free Community edition:

  • Download Visual Studio for Mac from visualstudio.microsoft.com.
  • Visual Studio for Mac Tools for Unity are installed automatically during the installation process.
  • Follow the steps in the installation guide for additional installation help.

Note

Visual Studio for Mac Tools for Unity requires Unity version 5.6.1 or above. To verify that Visual Studio Tools for Unity are enabled in your version of Unity, select About Unity from the Unity menu and look for the text 'Microsoft Visual Studio Tools for Unity enabled' in the bottom-left of the dialog.

Confirm that the Visual Studio for Mac Tools for Unity extension is enabled

Visual Studio Tools For Unity

While the Visual Studio for Mac Tools for Unity extension should be enabled by default, you can confirm this and check the installed version number:

  1. From the Visual Studio menu, select Extensions....

  2. Expand the Game Development section and confirm the Visual Studio for Mac Tools for Unity entry.

Configure Unity for use with Visual Studio for Mac

Starting with Unity 2018.1, Visual Studio should be the default external script editor in Unity. You can confirm this or change the external script editor to Visual Studio:

  1. Select Preferences... from the Unity menu.

  2. In the Preferences dialog, select the External Tools tab.

  3. From the External Script Editor dropdown list, choose Visual Studio if it is listed, otherwise select Browse....

  4. If Browse... was selected, navigate to the Applications directory and select Visual Studio and then click Open.

  5. Once Visual Studio is selected in the External Script Editor list, close the Preferences dialog to complete the configuration process.

Awesome!! Today, Microsoft released a “code optimized” version of Visual Studio called Visual Studio Code that will run on Mac and Linux (and of course Windows). And it is BEAUTIFUL! I’ve been looking for an alternative to MonoDevelop with Unity 3D for some time, and VS Code feels like it might be the real deal.

Some early commenters on the Unity 3D forum were peeved that it’s not a full-blown IDE, or “it’ll only be good for Javascript and web dev”. Do not listen to the naysayers! Granted, it is a “Preview” version product, but so far, it is working with Unity 5 like a charm.

Setting up VSCode for Unity is Simple, but Read This!

It is simple to get it working, but you need to do a couple of things. Some people on the Unity forums tried to simply download Code and open their c# files and the intellisense didn’t work, and they assumed that VS Code was a bust. I admit, that’s exactly what I did, but I didn’t give up. Here are the simple steps:

  1. Download and install Visual Studio Code from Microsoft
    1. It’s simple on the Mac…just drag the .app to Applications folder once you open the downloaded package
  2. Open your Unity project
  3. Go to Assets > Sync MonoDevelop Project (this will make sure your .sln file is all set)
  4. Open VS Code
  5. Do File > Open in VSCode and open your Unity project folder (top level of your project)
  6. Important – at the bottom of the VS Code window, there is a blue status bar. You should see a little fire icon. It may be followed by # projects. Click that icon and select your project’s csharp.sln file. When you click the icon, it will pop up a box at the top that lists the available solution files. You want the one that is named “<your project name>-csharp.sln”.
    1. If the box at the top of the screen has an option that says “Change projects”, that means you’re already working in a project. In this case, you can:
      1. Click “Change projects”
      2. Then select your project’s csharp.sln file as above

Visual Studio Code on a 2013 MacBook Pro- 1st Day Impressions

  • Intellisense is working beautifully with my project’s code
    • You can even leave a word half finished go away with the cursor and come back and Intellisense will pick it up and start working where you left off. I’ve been using VS 2010 at work lately and it doesn’t do that…very annoying
  • VSCode is fast and responsive
  • It looks great!
  • Haven’t tried the Git and probably won’t. I’m using SourceTree for BitBucket with Unity and the integrated client in Xcode for normal dev
  • It feels like a native Mac app, but some of the Keyboard shortcuts aren’t Mac…maybe there’s a way to fix that
    • For instance, Cmd-Delete is supposed to delete everything to the left of the cursor back to beginning of the line of text you’re on, but it doesn’t appear to be doing anything
    • Shift+Cmd+k deletes the whole line
    • Control-Delete, weirdly, duplicates the text on the line…huh.
    • Control-Clicking on a file in the file tree opens the code in side-by-side view with the existing file in the editor…neat
    • I tried editing the Keyboard shortcuts, but adding my edits to the override file didn’t work, even after restarting the app. You can tell it’s early days since that process is you editing a json file.

Unity Visual Studio For Mac

All-in-all, I’m very happy to have Microsoft supporting Mac with this. They also announced a code transformer that will let you take your iOS objective-c code and port it to Windows phone with minimal tweaks. That’s going to be interesting too. Microsoft is really doing some very interesting things. Good on ya!

Cheers,

Unity Visual Studio Setup

Byron

Comments are closed.