Unity VScode Integration Problem - SOLVED

 




Getting Unity VScode to work on Unity particularly 2018, but may work on other versions too.

Visual Studio Code.


Getting VScode to successfully integrate with the Unity Game Engine was a real pain in the eye, as I sought, for weeks, downloading and installing all sorts of arsenals, yet dealing no damage to my frustration.


Though I already had Visual Studio Community 19, I wanted the speed and lightness in Visual Studio Code, so I downloaded all available Net FrameWorks, installed mono, or so did I. And whatever, yet nothing.


However, the solution was very simple, just not common. XD


The log on the Omnisharp Error Indicated that the Unity project required Net Target FrameWork v4.5. However, this version at the moment is not even available for download.


The solution is therefore to disguise another Target FrameWork as v4.5. 


Others seem to get it done by duplicating, say v4.7.2, and renaming it to v4.5, but that didn't work for me.


So I found this method, using CMD to create a directory that emulates the target folder.


Here's the process:



# Goto the net directory (mine is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework") to copy the path

#Open comand prompt (CMD) as admin

# Enter "cd" and then directory you copied

#press "Enter"

#Type "mklink /J v4.5 v4.7.2"...this creates a virtual directory with the name v4.5, but with contents of v4.7.2 (if you've not installed .Net 4.7.2, you can enter the one you have). 

#Done!!


Open a project in Unity. Create a script and open it.

Make sure the Unity's external editor is to VScode (it's not compulsory, but ease of use).

When VScode opens, wait till Omnisharp starts and run below (lower left).

When it's fully loaded, you'd see the name of your project at the bottom left.


Happy coding!!!




No comments:
Write Comments