Integrating Visual Studio with Unity for Game development.

Photo by SCREEN POST on Unsplash

You just started learning game development with Unity and now you need to write a script (let’s say you want to provide basic movement capabilities to your character). So, you figured out that you need to install Visual Studio, so you downloaded and installed it in your system.

Now, that you have both Unity and Visual Studio installed, you decide to proceed forward, so you click on the C# script that you have created and Snap! You realise you are not getting any recommendations or code completions from the IDE for the Unity components.

No recommendations and code completions in the IDE

But isn’t that what an IDE is supposed to do? Make your life a little easier by completing the code for you and making all the methods in a class readily available to you? So what went wrong?

Well, do not worry! You have missed a very simple step due to which it’s not working as expected and this is what this article intends to help you fix.

In this post, I will guide you through the following:

  1. Downloading the correct Visual studio.
  2. Creating a new C# script in Unity.
  3. Integrating Visual Studio with Unity.

Let’s dive in!

Downloading the correct Visual studio.

Here, you can find the link to download the Community edition of Visual Studio .

NOTE: The Professional and Enterprise editions are paid.

Depending on your platform, download the correct Visual Studio. Also, I wouldn’t recommend downloading ‘Visual Studio Code’ as it is just a code editor, not a fully integrated IDE unlike the Visual Studio. I’ll be demonstrating the MacOS version here.

Let the downloading and installation happen in the background. Meanwhile, we will see how to create a C# script in Unity.

Creating a new C# script with Unity.

Open Unity and look for the ‘Project Hierarchy’ panel. You will be able to see the ‘Assets’ folder here. (In my case, I have ‘Assets’ and ‘Packages’)

Right click on the Assets folder shown in the previous image and create a new ‘Folder’ as shown in the image below and name it as ‘Scripts’

Once you’re done, you will have something like this:

Right click on the Scripts directory and create a new C# Script as shown in the image below and provide it a proper name. Since we were trying to bring the protagonist to life, we will name it as ‘player’ without specifying any format.

You will now have a C# script generated with the basic code which can be seen in the ‘Inspector’ panel.

DO NOT click on the C# script yet. Now, we will go back and check if the Visual studio installation has finished. If it hasn’t, wait for it to finish since you don’t have any application capable of running a C# script yet.

Once installed successfully, we are ready to proceed further!

Integrating Visual Studio with Unity.

This is the most important part so make sure that you follow all the steps in this section.

Click on the Unity tab and select ‘Preferences’ as shown in the image below.

Click on the dropdown in the external tools section and select ‘Visual Studio’.

NOTE: It will not be reflected if the Visual Studio installation has not finished yet.

In case Visual Studio has finished installing and you are still not able to see it in the dropdown, click on Browse…, navigate to Applications on your Mac, click on Visual Studio and select ‘Open’ as shown in the image below.

Now that Visual Studio is integrated with Unity, select the ‘player’ C# script which we had created in the previous section and wait for it to launch.

Let’s try the same thing which we had tried before, we will see if we can utilise the full potential of the IDE:

And that's it! We have now successfully integrated Visual studio with Unity and now are one step closer to bring our character to life.

Android Developer by profession | Game Developer by passion

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store