Search Unity

No suggestions in Vscode

Discussion in 'Code Editors & IDEs' started by Artiommm, Aug 20, 2020.

  1. Artiommm

    Artiommm

    Joined:
    Jun 29, 2019
    Posts:
    5
    Hey, I recently installed unity on linux and tried connecting Unity with Vscode. Turns out it's one big enigma, I searched all forums and either the answer was one windows or it just didn't work.
    The weird part is that it worked at some point, I remember yesterday i got it to work but today i wake up eager to continue working on my project, and boom no suggestions.

    Important:
    I am getting, "Some projects have trouble loading" from the c# extension I assume it is somehow related. here is the output:

    Starting OmniSharp server at 8/20/2020, 12:13:13 PM
    Target: /home/artiom/Desktop/unity-workspace/Gravity/Gravity.sln

    OmniSharp server started.
    Path: /home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/run
    PID: 13033

    [info]: OmniSharp.Stdio.Host
    Starting OmniSharp on ubuntu 20.4 (x64)
    [info]: OmniSharp.Services.DotNetCliService
    DotNetPath set to dotnet
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Located 1 MSBuild instance(s)
    1: StandAlone 16.8.0 - "/home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin"
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    MSBUILD_EXE_PATH environment variable set to '/home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Registered MSBuild instance: StandAlone 16.8.0 - "/home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin"
    CscToolExe = csc.exe
    MSBuildToolsPath = /home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin
    CscToolPath = /home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Roslyn
    BypassFrameworkInstallChecks = true
    MSBuildExtensionsPath = /home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild
    [info]: OmniSharp.Cake.CakeProjectSystem
    Detecting Cake files in '/home/artiom/Desktop/unity-workspace/Gravity'.
    [info]: OmniSharp.Cake.CakeProjectSystem
    Could not find any Cake files
    [info]: OmniSharp.MSBuild.ProjectSystem
    Detecting projects in '/home/artiom/Desktop/unity-workspace/Gravity/Gravity.sln'.
    [info]: OmniSharp.MSBuild.ProjectManager
    Queue project update for '/home/artiom/Desktop/unity-workspace/Gravity/Assembly-CSharp.csproj'
    [info]: OmniSharp.Script.ScriptProjectSystem
    Detecting CSX files in '/home/artiom/Desktop/unity-workspace/Gravity'.
    [info]: OmniSharp.Script.ScriptProjectSystem
    Could not find any CSX files
    [info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    [info]: OmniSharp.MSBuild.ProjectManager
    Loading project: /home/artiom/Desktop/unity-workspace/Gravity/Assembly-CSharp.csproj
    [info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    [info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    [info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    [info]: OmniSharp.WorkspaceInitializer
    Configuration finished.
    [info]: OmniSharp.Stdio.Host
    Omnisharp server running using Stdio at location '/home/artiom/Desktop/unity-workspace/Gravity' on host 12919.
    [fail]: OmniSharp.MSBuild.ProjectLoader
    The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    [warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file '/home/artiom/Desktop/unity-workspace/Gravity/Assembly-CSharp.csproj'.
    /home/artiom/Desktop/unity-workspace/Gravity/Assembly-CSharp.csproj
    /home/artiom/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1178,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

    [fail]: OmniSharp.MSBuild.ProjectManager
    Attempted to update project that is not loaded: /home/artiom/Desktop/unity-workspace/Gravity/Assembly-CSharp.csproj


    I installed everything needed(.NET, C# extension, Unity Tools) yet it is still not working.
    Basic C# suggestions are working.
    I also put the binary file of vscode as the external tool of unity

    Thanks in advance!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
  3. Artiommm

    Artiommm

    Joined:
    Jun 29, 2019
    Posts:
    5
  4. Gramms66

    Gramms66

    Joined:
    Aug 15, 2017
    Posts:
    31
    I had lots of problems with setting up VSCode as well after a system crash I had. You have the C# extension set up so that is good, you also need the extension called Unity Snippets, also if you want to do debugging there is an extension for that too, you can find it by searching for unity debugger.

    Now the solution for me (that I couldn't find online, only the problem) was to update the VSCode package inside of Unity. Yes there is a package for VSCode, I was surprised. You jost go: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Hope that this will solve it for you too.
     
    Kurt-Dekker likes this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    @Gramms66 I am going to add your idea to my handy list of troubleshooting items for this issue. Hopefully this will get OP going again!
     
    Gramms66 likes this.
  6. Artiommm

    Artiommm

    Joined:
    Jun 29, 2019
    Posts:
    5
    Thanks you but the package manager said it's up to date :/. also sadly the vm idea went horribly wrong so yeah im stuck again with 0.5% auto-completion.
    EDIT: Thanks for the extensions too
     
  7. OxChonMars

    OxChonMars

    Joined:
    Apr 16, 2020
    Posts:
    1
    I had the same issue and here is how I fixed it.

    1. Download the latest stable Mono here
    https://www.mono-project.com/download/stable/

    2. Add FrameworkPathOverride to the .bash_profile
    export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current

    Restart VSCode and It works.
     
    profitdefiant and Gramms66 like this.
  8. Artiommm

    Artiommm

    Joined:
    Jun 29, 2019
    Posts:
    5
    Thanks for the reply, first of all now when i do "sudo apt update" i get this output

    W: GPG error: https://download.mono-project.com/repo/ubuntu stable-focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A6A19B38D3D831EF
    E: The repository 'https://download.mono-project.com/repo/ubuntu stable-focal InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: https://download.mono-project.com/repo/ubuntu vs-bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A6A19B38D3D831EF
    E: The repository 'https://download.mono-project.com/repo/ubuntu vs-bionic InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.


    Second im not sure when exactly you want me to put the FrameworkPathOverride, I found a .bash_profile.save in home but didn't find a .bash_profile. I put it there and it didn't work. do you mind helping here? I actually didn't try this fix and I think it might actually work
     
  9. Teos

    Teos

    Joined:
    Jul 30, 2015
    Posts:
    2
    I solved the same issue by downgrading VSCode C# extension from 1.23.1 to 1.23.0
     
    caden-burleson and Alex_May like this.
  10. pjuu

    pjuu

    Joined:
    Feb 10, 2015
    Posts:
    1
    @Teos that solved this issue for me! Much appreciated.
     
  11. Artiommm

    Artiommm

    Joined:
    Jun 29, 2019
    Posts:
    5
    EDIT: thank you so much, downgrading to 1.23.0 didn't actually help, but going a little lower helped.
     
    Last edited: Aug 21, 2020
    Alex_May likes this.
  12. JohnGabin

    JohnGabin

    Joined:
    Mar 31, 2020
    Posts:
    3
    @Teos, it works. Finally. I'm on Mac OSX and this is the simplest but most effective way I found to solve this.
     
  13. allpublic

    allpublic

    Joined:
    Nov 10, 2020
    Posts:
    13
    I had the same issue with different versions:
    Unity 2020.3.0f1
    Visual Studio 2019 Mac
    Visual Studio Code Editor 1.2.3
    Visual Studio Editor 2.0.7
    I downgraded both one version to 1.2.2 and 2.0.5 and then it worked again!
     
  14. alfredberg90

    alfredberg90

    Joined:
    Nov 24, 2019
    Posts:
    2
    Tried all above. Downgrading C# extension from 1.25.0 to 1.23.0 solved it.

    Good luck out there!
     
  15. treborguy

    treborguy

    Joined:
    Apr 17, 2014
    Posts:
    30
    I found a solution without downgrading. I too was getting the error "Omnisharp server is not running" and downgrading didn't work for me. At one point it fixed itself but then stopped working again in the next session. This solution below seems to fix it permanently.

    1) Go to settings.json in the .vscode folder

    2) Put this line in just above "files.exclude":
    "omnisharp.useModernNet": false,

    3) Save settings.json

    4) You should get a prompt asking if you want to restart OmniSharp. Say yes. It might now already be fixed, but if it complains that the "OmniSharp server is not running" goto step 5

    5) Restart vscode

    6) Remove the line mentioned in step 2, save, hit "restart OmniSharp" on the prompt, put the line back in again, save, hit "restart OmniSharp".
     
  16. migellen

    migellen

    Joined:
    Sep 19, 2020
    Posts:
    8
    Sorry, new to VS Code and Unity where. Where exactly do I go to run the expory command? `export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current`.
     
  17. Pnvanol

    Pnvanol

    Joined:
    Jan 11, 2016
    Posts:
    116
    I downgraded but I was only able to debug once...