Search code examples
unity-game-enginevisual-studio-codeomnisharp

Unity 2018.3.X problem with autocompletion


Using Unity 2018.3.X just installed does not let you use Visual Studio Code nor MonoDevelop to code right.

  • Precompile is disabled
  • No debugger
  • No autocompletion
  • Errors everywhere

Solution

  • I solved it myself with some hours dedicated to this thing.

    I was installing Visual Code as usual on a new computer but when trying to edit code the autocompletion did not work, also tons of errors popped.

    When I installed I added the normal plugins for Unity in Visual Code

    • C#
    • Unity debugger

    When reloading Visual Code, the Omnisharp log said that the compiler did not find the .NET Framework 4.5 and anything works within your C# scripts.

    When looking into it I found this folder in Windows.

    (If someone knows where it is in iOS share it please)

    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
    

    That folder showed folders with the versions of the frameworks installed. In my case, those were 3.0 and 4.5.2.

    The problem is that for some reason it does not detects the version 4.5.2 as 4.5 so to fix it normally you should install version 4.5, the problem is that you cant get it anymore.

    To solve this, look at the Omnisharp log and change the folder name to the one your Omnisharp says, in my case I changed the name of 4.5.2 to 4.5 and my problem was solved.

    I have seen more cases where the version the Omnisharp wants is different, just download the 4.X version you want from this link and change the folder name if you need.

    https://dotnet.microsoft.com/download/visual-studio-sdks

    Keep you .NET Core updated too to avoid more problems.