Search Unity

Resolved [SOLVED] Unity with VS Code and intellisense on Linux Mint

Discussion in 'Linux' started by fran_m, Oct 10, 2020.

  1. fran_m

    fran_m

    Joined:
    Jul 22, 2020
    Posts:
    40
    Hi,
    Which c# script editor with Intellisense capabilities are you using with Unity Editor on Linux?
    Thanks
     
    MrFun006, Tryptex and nikolain95-ru like this.
  2. fran_m

    fran_m

    Joined:
    Jul 22, 2020
    Posts:
    40
    I found one: VS Code
    I did these steps to make it work with Itellisense in Linux Mint 20 Cinnamon (son of Ubuntu 20.04):

    0. I assume you already have Unity Editor running with the latest nvidia drivers
    1. Install VS Studio from .deb file (https://code.visualstudio.com/docs/setup/linux)
    2. Open VS Code and install de C# extension OmniSharp (you will be asked to install it when you open VS Code). After tah close VS Code
    2. Install .net SDK from here: https://docs.microsoft.com/es-es/dotnet/core/install/linux-ubuntu#2004-
    3. Install latest Mono release (Ubuntu 20.04): https://www.mono-project.com/download/vs/
    But the next line must be changed:
    deb https://download.mono-project.com/repo/ubuntu vs-focal main
    for this one:
    deb [arch=amd64] https://download.mono-project.com/repo/ubuntu vs-focal main

    (just added [arch=amd64] )

    4. Open VS Code, go to menu File - Preferences - Settings - Extension - C# configuration
    look for "Omnisharp: Use Global Mono", and set it to "always".
    5. Close VS Code
    6. Go to Unity menu Edit - Preferences - External Tools - External Script Editor, and pick "Visual Studio Code"
    7.In the same window, check "Embedded packages", "Local packages", "Built-in packages", "Git packages" and after click on "Regenerate project files"

    Hope it helps
     
    Last edited: Oct 18, 2020
    iohnS, parkournick2, roy_m and 46 others like this.
  3. victorjchamorro

    victorjchamorro

    Joined:
    Mar 6, 2021
    Posts:
    1
    Thanks for sharing !!! It's working fine for my in Debian 10 !! Thanks very much! :)
     
    Tryptex and nikolain95-ru like this.
  4. Tryptex

    Tryptex

    Joined:
    Jul 3, 2017
    Posts:
    13
    Thank you very much! I got everything right up to forcing global mono and regenerating the project files, I would never have figured that out on my own.
     
  5. PellionX

    PellionX

    Joined:
    Apr 20, 2021
    Posts:
    1
    Many thanks! Every other source I could find says to set "Omnisharp: Use Global Mono" to "Never" for some reason. After several hours of frustration, you have saved my day.
     
  6. aandrade64k

    aandrade64k

    Joined:
    May 14, 2021
    Posts:
    1
    THANK YOU!!!!!!!!!
     
  7. ibqn

    ibqn

    Joined:
    May 30, 2021
    Posts:
    1
    Figured all that out myself, after spending an hour of research and tweaking stuff, and than finally found your post and screamed, Nooooaaahh. Thanks, very
     
  8. Skepller

    Skepller

    Joined:
    Aug 25, 2021
    Posts:
    1
    Wow @fran_m what a goat! I was almost giving up on my own research until I just googled a super generic "unity coding linux" and found this post. Worked like a charm!
     
  9. MateuszTulski

    MateuszTulski

    Joined:
    Jul 9, 2017
    Posts:
    1
    You are the BOSS !
     
  10. MrFun006

    MrFun006

    Joined:
    Nov 10, 2021
    Posts:
    2
    Thanks a lot its working
     
  11. TTuPC

    TTuPC

    Joined:
    Mar 22, 2021
    Posts:
    36
    Thank you so much!
     
  12. Naushikha

    Naushikha

    Joined:
    Dec 17, 2014
    Posts:
    1
    I keep coming back to this post to setup Unity on any new Linux Mint installation. Thanks a bunch @fran_m!
     
  13. argamidon

    argamidon

    Joined:
    Nov 15, 2018
    Posts:
    2
    Thank you very much, BOSS :)
     
  14. andresjesse

    andresjesse

    Joined:
    May 23, 2017
    Posts:
    1
    Thanks! Working on Pop OS! (ubuntu-based) with Unity 2022 Beta!
     
  15. josealfu

    josealfu

    Joined:
    Jan 16, 2022
    Posts:
    4
    You are a hero. These instructions should be in the official doc. Thanks!
    Tested with Zorin Lite.
     
  16. clausiusreis

    clausiusreis

    Joined:
    Sep 14, 2016
    Posts:
    4
    fran_m... I owe you a beer!!!
     
  17. Jonas_freire

    Jonas_freire

    Joined:
    Mar 13, 2022
    Posts:
    1
    Thank you so much!
     
  18. JayLog

    JayLog

    Joined:
    Dec 17, 2016
    Posts:
    2
    Hi everyone! I followed the steps but I get these error messages on Pop_OS!

    I get this in Unity when trying to open a script:
    DotnetMonoError.png


    And when clicking OK it opens VS Code, where I'm greet with this other message:
    SDK_VSCode.png


    I do have Mono and Dotnet installed. I'm new to Linux so I really don't know what to do here.

    Anybody got the same issue?
     
  19. SnowKaya

    SnowKaya

    Joined:
    Oct 5, 2021
    Posts:
    5
    Aparently this is an error from the Unity Debugger extension, if you have installed VsCode trough flatpak i strongly recommend you to install the .deb version, either from Microsoft's website or Pop Shop. For VsCode and other IDEs in general it's easier to use the native version, it just work out-the-box.

    I think this is because VsCode was installed via flatpak, maybe it isn't detecting the .net install since flatpak apps are contained from the rest of the system.
     
  20. JayLog

    JayLog

    Joined:
    Dec 17, 2016
    Posts:
    2
    Hi, thanks for the answer! I did install VS code from Pop Shop first but in that case I get this error:
    Screenshot from 2022-04-04 13-43-11.png

    Even though I do have VS Code installed, that's why I tried with the flatpak version instead.
    In Preferences > External Tools, I have "code" selected as my main editor but that was auto completed. I couldn't actually find the editor by browsing, maybe Unity is looking for it in the wrong place?
    I'm new to linux so I don't really know how to check :(
     
  21. fbarnaud

    fbarnaud

    Joined:
    Mar 11, 2021
    Posts:
    4
    Hi,
    I have the exact same issue on PopOs ! Does someone knows how to solve this ? What is really strange : when I browse through my explorer I can find where the code executable is, but for some reason when browsing through Unity explorer it does not appear...

    However, if I switch to "Open by file extension", then C# scripts are opened with code and IntelliSense is working since I installed .NET sdk manually + following initial post.

    EDIT : seems the main issue I had is not linked to VS studio directly. I had Unity Hub installed with flatpak, and for some reason the full unity editor was running in sandbox, not accessing the full hard drive (to my understanding).
    I have now installed Unity Hub 3.0 following this link : https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux
    Now I do have access to code directly + Intellisense
     
    Last edited: Apr 8, 2022
    JayLog likes this.
  22. sakunix

    sakunix

    Joined:
    Jan 25, 2022
    Posts:
    17
    Omnisharp configuration changes and no longer works. "Use Global Mono" no longer exists
     
  23. MX-Pain

    MX-Pain

    Joined:
    Sep 27, 2020
    Posts:
    49
    You can click on the gear icon (right next to the C# extension, inside VC) and select , install another version. And select one of the few options appear in the dropdown menu. Can't remember which I pick cuz I'm not on the pc right now but it was one from 2-3 previous versions. Reload VC and look for the options on omnisharp and set it to always again.
     
  24. mechane

    mechane

    Joined:
    Nov 17, 2018
    Posts:
    6
    Now you only need to uncheck Omnisharp:useModernNet instead of step 4. Do every other step mentionned above by fran_m
     
  25. ian_sorbello

    ian_sorbello

    Joined:
    Jul 1, 2014
    Posts:
    6
    Legend! I worked on this prob for hours following similar advice from other threads. This is the one that worked! I think the [arch=amd64] was the magic dust. :D
     
    bakhtrian likes this.
  26. esillen

    esillen

    Joined:
    Jul 18, 2014
    Posts:
    1
  27. iohnS

    iohnS

    Joined:
    Jan 4, 2020
    Posts:
    1
    Still works for my, Ubuntu 22.04. Checked the "Dotnet > Server > Use Omnisharp" to true which worked for me after restarting.