Installing Visual Studio Community for Unity Development

By Brian Moakley Jul 23, 2023

A good Integrated Development Environment (IDE) is necessary to write good code. At least, in the beginning, it is. Visual Studio is one such development environment. It’s the gold standard for such programs.

An IDE contains everything you need, and more, for writing code. It provides syntax highlighting and lets you know if you made any errors. IDE features built-in documentation built right into the editor, making it easy to look things up. It features tools to diagnose issues, aka bugs, as well as an assortment of tools to make writing code easier.

While you don’t need an IDE to write code, you’ll find that once you become used to them, you’ll never want to write code without one. In the previous article, you installed Unity. In this one, you’ll get your code editor installed.

Choosing your code editor

Visual Studio is the preferred IDE for Unity, but that was not always the case. In the old days, Unity shipped for Mac with an IDE called MonoDevelop. While it worked well enough (I’ve written games in it after all), it was not a pleasant editor. Code writing sessions often felt like wrestling matches.

A screenshot of MonoDevelop. MonoDevelop is an IDE used to write C# but was historically unpleasant to use.
MonoDevelop was a painful editor back in the day

At some point, Microsoft released a version of Visual Studio for the Mac called Visual Studio Code. While I was skeptical at first, this simple editor has become my “go-to” editor of choice for all development tasks on a Mac. It’s just that good.

Soon after, it didn’t take long for Microsoft to port Visual Studio to the Mac. Now, Visual Studio Community (the free version) is the recommended code editor for Unity for both Windows and Mac.

If you’ve taken my YouTube course on Unity, you will have been using Visual Studio Code. This was a mistake as it requires a bunch of extra steps, causing issues with students. It also doesn’t support live debugging in Unity which is an essential tool.

A picture of Visual Studio Code which is an excellent editor only surpassed by Visual Studio Community.
Visual Studio Code is one of the best most versatile code editors that I’ve used. You can write anything in it and it supports Windows, Mac, and Linux

In the following sections, I’ll describe how to install Visual Studio Community for both Mac and Windows. Should you have issues, please leave a comment, or leave a message in the Forums. Mind you, I’ll do my best to help you but I’m not a dedicated support technician. If your problem is beyond my knowledge, I’ll recommend you to official support.

Visual Studio versions

Like Unity, Visual Studio is not free software. In fact, back in the day, it could be an easy two thousand dollars to get a stripped-down version of the suite. These days, you can get Visual Studio for free, but ultimately, Microsoft wants you to be a paying customer.

Visual Studio Community is the free version. It’s meant for open-source development and education. Once you reach a revenue spike of over a million dollars and your company exceeds five people, you must use Visual Studio Professional. Like Unity, you pay once you start achieving some sort of revenue threshold.

Visual Studio Professional gives you the base editor but all the bells and whistles. You also gain access to a few services. Being the year 2023, this editor is now subscription based so you are looking to pay forty dollars per month.

Visual Studio Enterprise gives you everything you could possibly need to develop software. This is the highest tier so naturally, it sports the highest price. This costs a cool two hundred and fifty per month.

If you are curious about all the different versions and the features between them, you can read more on Visual Studio’s comparison page. This series of articles will be using Visual Studio Community.

Note: Since I wrote this article, Microsoft officially announced that Visual Studio Community for macOS will be retired in 2024. You should use Visual Studio Code instead. I will be producing an article on this soon.

Installing Visual Studio on macOS

To install Visual Studio Community on a Mac, head over to the following link:

Skip over the editions, and scroll down the page until you see a listing for Visual Studio on a Mac. This may have changed by the time you are reading this.

A screenshot of the Visual Studio Community download button on the official web site.

Make sure to click the Free download button. This will prompt you to download a dmg file. Download and run the file. When the installer opens, you’ll be presented with some installation options. Keep the default items selected and click the Install and Update button.

A prompt presented by the installer asking to install components.

It’s going to take a little time to install. Sit back. Put your feet up. Have a cold iced tea! :D Keep in mind, you will be prompted to enter your password one or two times.

When the application finishes launching, you’ll be presented with a project launch window. All your various projects will show up in that window.

A screenshot of Visual Studio Community's project browser.

Believe it or not – that’s it! The application uses a special extension for Unity support. To verify the extension installation, click Visual Studio / Extensions.

A screenshot of Visual Studio Community's application menu. The "Extensions..." option is highlighted.

This will open an Extensions window. Click the Installed tab and check to see Visual Studio for Mac Tools for Unity is in the list.

A dialog showing a listed of installed components. The "Visual Studio fro Mac Tools for Unity" is installed.

If for some reason, you don’t see it listed, then click on the Browse tab and search the listings. Select it and click the Install button. And that’s it! You have Visual Studio installed on the Mac!

Installing Visual Studio on Windows

To install Visual Studio Community on a Mac, head over to the following link:

You’ll see a whole bunch of options. Click the download link for the Community edition.

A screenshot of the Visual Studio downloads page with Visual Studio Community download button highlighted.

Download the file and run the installer.

A dialog from Visual Studio Community starting the installation process.

It will take the installer a little time to complete as it downloads all of the components. Once complete, do not press the Launch button. Press the Modify button, instead.

An image of the Visual Studio Installer. The Modify button is highlighted.

This new dialog allows you to customize your installation. You can install special workloads, language packs, and install individual components. The Workloads tab is selected by default.

A screenshot of the Visual Studio Installer that shows various workloads. The Game Development with Unity workload is selected.

Scroll down until you see a Gaming category. It should contain an item called, “Game Development with Unity”. It should come installed with Unity. If it is not checked, check the item and click the install button. Now you can launch the editor.

In the case, you launched the application instead of checking for the Unity tools, you’ll be presented with a project window. All your code projects will appear in this window. Since you haven’t written any code yet, the window is empty.

Press the Continue without code option. This opens a blank editor. Select the Tools menu option. From the dropdown, click the Get Tools and Features option.

A screenshot showing the user selecting the "Get Tools and Features..." option in Visual Studio Community.

This will open the installer and present the Workloads tab. From there, you can scroll down and find the Unity tools as described earlier in the article.

Installing Unity on Linux

Believe it or not, you can actually use Unity on Linux. The process requires some understanding of the terminal. Also, being that Visual Studio Community, you’ll need to either use Visual Studio Code or use a native Linux code editor. Of course, you could try to run the application under something like Wine but you may run into lots of issues. Personally, I would use something like Visual Studio Code or JetBrains Rider.

Unity does provide instructions on how to install Unity for distributions such as Debian (and Ubuntu) as well as Red Hat (and CentOS). If you are using a different distribution then you’ll probably need to do some additional configuring to get Unity to work. Chances are, someone has already produced a guide on it.

You can find instructions on how to install Unity Hub for Linux on Unity’s official site. Also, make sure to check out the Linux support forum in case you have any issues. Unity Technical Support seems pretty active on it.

Testing your installation

Okay, you’ve read this article and you have a working code editor. It’s time to put it to us. To test this, you’ll create a very simple project.

Launch Unity Hub. In the upper right-hand corner, click the New project button.

A screenshot using the project listing with the New product button highlighted.

This brings you to the project template selection dialog. By default, Unity games were 3D and looked quite ugly. It took a lot of work to configure the editor for your workflow. Now we have templates that do all that work for you.

In your project, you will be playing with code so the 3D Core project is fine. Select the 3D Core project. For the project name, give the name: Beginning C Sharp. Feel free to choose your save location. Then click the Create project button.

Creating a project opens the Unity editor. There are a lot of buttons and the whole thing can seem a bit overwhelming. First, you need to configure the code editor.

If you are on a Mac, select Unity \ Settings. If you are on Windows, select Edit \ Preferences. This opens your preferences window. Select the External Tools option. Then, from the External Script Editor option, select Visual Studio from the dropdown. Close the window.

Now to write a small bit of code. In Unity, at the center bottom of the screen, you’ll see a tab called Project. It should look like the following:

If your window looks different, then click the dropdown in the upper right hand corner. It should be next to the drop-down that reads Layers. Select the Default options.

To create your first script, click the Plus button underneath the Project tab.

You’re going to see a ton of options. Since this is an article series about writing C#, choose the C# Script. It should be the second option.

Once you select the option, Unity will add the script in your Projects tab. Give it the name, HelloWorld. Name it exactly as printed here. Notice there are no spaces and the H and W are capitalized.

Now for the moment, you’ve been waiting for! Double-click on the HelloWorld script. This will open Visual Studio. Now to write your first line code!

Writing some code

When Visual Studio launches, you should see something like this.

If you’ve never typed code before, this is overwhelming. Each line has its purpose, but don’t worry about learning what everything is doing. You will in time. Instead, focus on what you are doing.

Now, underneath the code void Start() between the curly braces, type: Debug.

Make sure to include the period after the word Debug. It should exactly match the code below:

void Start()

Whenever you type code, always write it exactly as you see it. Case matters along with weirdly placed punctuation marks. Now, once you press the period, you should see a whole bunch of options. That lets you know that your editor is working with Unity.

Finish the code with the following, making sure to match the code listed below:

void Start()
  Debug.Log("Hello World");

Notice the line ends with a semi-colon. A semi-colon is the ending of a single statement of code. Think of it like a period at the end of a sentence. What does Debug mean? How about Log? Who cares! You wrote a line of code.

If you typed it wrong, you might see some red squiggles like the following:

In the example, I forgot to add a close quotation mark. The red squiggles indicate an error. If you see a red squiggle, compare your code with the article again. Chances are, you lowercased a letter when it should have been uppercased. Your code should look exactly as this:

Save and switch back to Unity.

Now, drag your HelloWorld script to the upper left-hand side of the screen. Drop it on the Main Camera.

Finally, in the top center of the screen, press the play button. This will start the game. Granted, it’s not a game, but it will run your code.

Down by your Project tab, you’ll see another tab called Console. The Console is a way to print messages to the screen for testing and logging purposes. Users will not see them.

Click the tab and you’ll see Hello World printed.

If for some reason you don’t see the Console, select Window \ General \ Console and it will appear. Nice work!

Where to go from here

Congratulations! You wrote your first bit of code! Granted, it didn’t do much besides printing out text to the console. And of course, the text was only visible to you. Ideally, you want to the article to appear in the game world.

You’ll do this in time, but before you can do anything, you need to get orientated to Unity itself. The next article will give you a tour of the interface. You’ll be writing code soon enough!

By Brian Moakley

Brian Douglas Moakley is a writer and technologist who lives amongst the quiet hills in New England. When not reading tales of high adventure, he is often telling such stories to all who will listen.

Related Post

Leave a Reply