Search Unity

[Solved] Problems with OmniSharp and Visual Studio Code

Discussion in 'Code Editors & IDEs' started by tetriser016, Dec 15, 2016.

  1. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    SOLVED: Fixed the problem by reinstalling VS Code and the C# extension.

    I've used Visual Studio Code for few days now to edit my scripts. VSCode was working, before VSCode updates. After the update, OmniSharp fails to validate the Unity project files and the editor refuses to initialize IntelliSense. Is this a bug or my own end? Reinstalled the C# extension but no luck.

     
    Last edited: Jan 22, 2017
  2. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    I had to install Mono and it worked for me. http://www.mono-project.com/download/

    I also installed the other Unity related extensions but it was the Mono install that fixed that issue for me.

    Hope this helps.
     
    montblanc and wenderRondonia like this.
  3. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    @EdKirby - Not working either. Maybe I need to install the 64-bit version of Mono for my 64-bit laptop?
     
  4. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Hey @tetriser016 - Sorry for the very late reply. Hmmm...not sure. My Mac is 64 bit and all I did was download and install Mono from the link I posted above. If there is a 64 bit version perhaps trying that would help.
     
  5. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Oh, I should mention that since the time that I got VSC working I've completely jumped ship and moved to Windows. I'm running Parallels on my MacBook and went with VS Community 2015 and it works very well. I can do proper debugging now. The only issue I've found is when creating a new class, VS Comm 2015 doesn't (always?) make the connection that it's in the project so I don't have all the Unity namespaces and such until I restart VS.

    If you decide to go this route let me know. There are a couple of workflow gotchas you should be aware of.
     
  6. mcpunkylt

    mcpunkylt

    Joined:
    Feb 26, 2014
    Posts:
    4
    Try https://code.visualstudio.com/insiders for me it fixed these issues regarding VSCode and Unity 5.x integration on macOS:
    > No code errors or warnings being indicated.
    > No reference counting, peeking, etc.
     
  7. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    Thx, @EdKirby and @mcpunkylt.

    But I develop games on Windows, not macOS. Also, my internet connection just reaches its limit, so I can't download Mono.

    However, I got the latest update for Code after I reinstalling it.

    I got just one question, how can I make Unity find VSCode again after I uninstall it, without reinstalling Unity?
     
  8. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    @tetriser016 I haven't tried this but if you go Edit>Preferences then External tools you may be able to either find it in the drop down if Unity discovers it or browse to it manually.
     
    ZyderNarfall likes this.
  9. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    @EdKirby - Thanks, just browsed and located the Code.exe from Unity.
     
  10. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    Good news, now OmniSharp runs and successfully validates the Unity project files as it should.

    Code now got the Unity namespaces, but I dunno if this will persist... Thanks,
     
  11. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Kewl.

    Just out of curiosity, since you are on Windows anyway, why don't you use Virtual Studio 2015 Community Edition? It has almost all the same features as VS Pro, is free and (at least for me) it works better than Code.
     
  12. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    @EdKirby - Well, I do use VS 2015 Community as well, but my laptop isn't that "beefy" enough to make VS 2015 run faster. That's why I prefer Code.
     
  13. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Ah ok. Makes sense.
     
  14. wenderRondonia

    wenderRondonia

    Joined:
    Mar 15, 2015
    Posts:
    29
    Installing mono also worked for on Linux Ubuntu 16.04 Unity Editor!
     
  15. Seed_Value

    Seed_Value

    Joined:
    Jul 22, 2016
    Posts:
    3
    I have issue in Mac + Unity 5.5 with IntelliSense, codelenses - installing insider version fixed my issue.
     
    RedHillbilly and FetchQuestGames like this.
  16. montblanc

    montblanc

    Joined:
    Feb 13, 2015
    Posts:
    2
    Thanks @EdKirby, installing Mono Framework worked immediately on macOS Mojave!
     
    EdKirby likes this.
  17. ZyderNarfall

    ZyderNarfall

    Joined:
    Jun 11, 2020
    Posts:
    8
    Yeah this is what helped me out. I just hit the Reset Argument (3rd from the top)
    and I also hit the Regenerate Project Files. I don't get the notification any more.
     
  18. ShadowUser19

    ShadowUser19

    Joined:
    Apr 7, 2018
    Posts:
    6
    I also had this issue on my Mac & it was fixed after setting omnisharp settings to always use mono from a specific path:
    Code (JavaScript):
    1. {
    2.     "omnisharp.useGlobalMono": "always",
    3.     "omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands/"
    4. }
    I am not sure if there is a ".sln" specific solution for this, but at least it works & I use dotnet on my mac mainly for Unity projects anyway.
     
    assertor and alfish like this.
  19. unity_Bonf4DhEy6KkFw

    unity_Bonf4DhEy6KkFw

    Joined:
    Sep 22, 2020
    Posts:
    1

    This is the only thing that worked for me, thank you!
     
  20. victorliu233

    victorliu233

    Joined:
    Aug 28, 2022
    Posts:
    5
    Hi, I am still getting the same error when two projects open. Any thoughts? Thanks!
     
    Kokowolo likes this.
  21. Kokowolo

    Kokowolo

    Joined:
    Mar 26, 2020
    Posts:
    60
    I also have this problem, did you find a solution?