Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug VS Code autocomplete not working

Discussion in 'Code Editors & IDEs' started by PinkTreeArts, Mar 20, 2023.

  1. PinkTreeArts

    PinkTreeArts

    Joined:
    Dec 25, 2021
    Posts:
    11
    Okay, I'm really struggling here.

    I'm a newbie and I'm just trying to get started in Unity but everything seems to be going wrong. It's so hard to learn and all the answers I find online involve so many different concepts I don't understand.

    I had this problem: https://forum.unity.com/threads/mac...e-review-the-output-for-more-details.1001014/

    I just couldn't get VS Code to stop giving me this error message. I eventually REinstalled Mono-- I still have no idea what Mono is, and I hate installing software without knowing what it is, but I installed it even though I already had it installed. Same with .NET. It would be amazing if someone could actually explain to me what these things are in a way that's beginner-friendly because all I see in the documentation are a bunch of words I don't know and everytime someone explains something they just throw a bunch of other words I don't know at me. It's really disspriting trying to get into game development as a beginner because it seems that in order to fix the most basic bugs to get things working so you can start learning, you are expected to already be a programmer and know all these things. Anyway, I'm sorry to vent, but it's something I just find really disspiriting. When you spend all day trying to learn the basics of something and then nothing works and the only explanations you can find online involve a whole bunch of even more complicated and difficult things you don't understand.

    And I really, REALLY don't like installing things on my computer if I have no idea what they are.

    Anyway, I ended up disabling "Use Modern Net" in the C# extension on VS Code. Don't ask me what that is or what it means. I just did what the thing said, with no idea wtf I am doing.

    That seemed to solve the problem for a while.

    But now every time I open VS Code, I get another message, asking me to download Mono-- even though I've already downloaded it twice (still no idea WTF it is, but hey, I've downloaded and installed it twice already!)

    But I've noticed that the Unity autocomplete has stopped working again.

    I don't know... it seems to be some problem with Omnisharp-- again, no idea WTF that is, but there's a problem with it.

    Everything I've googled has just involved more and more things I don't understand.

    It really does feel like in order to become a programmer you have to already be a programmer. Not sure how you're supposed to even get started if nothing works in the first place.

    As for my computer, I'm on a MacBook, OS 10.15.7. VS Code version 1.76.2. VS Code C# Sharp extention 1.25.4. Unity 2021.3.21f1. Mono Framework 6.12.0.

    I googled how to look up the version of DOTNET you are running and it said to enter dotnet --list-sdks into terminal. Well, this is what I got.

    3.1.416 [/usr/local/share/dotnet/sdk]

    5.0.404 [/usr/local/share/dotnet/sdk]

    6.0.202 [/usr/local/share/dotnet/sdk]

    6.0.407 [/usr/local/share/dotnet/sdk]


    I just (re)installed it again today.

    Anyway, I don't mean to come off as pissed; I just would really appreciate if someone could explain things to me in language I can actually understand. I'm a pretty quick study but this stuff just feels really overwhelming.

    Here's the error message I keep getting. I don't know how many times I'm supposed to install Mono to get it to actually work.

    Screen Shot 2023-03-19 at 7.50.54 PM.png


    Earlier, I wasn't even able to USE Unity things (methods?). LIke I would use Time.deltaTime and get a compliation error in Unity. That problem seems to have gone away. At least now all I have is this annoying message every time I open VS Code, and I can't get Unity predictive text. I guess it's not the end of the world; just obscenely annoying and frustrating.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,388
    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,709
    Are you ready for more annoyance? Unity will be deprecating support for Visual Studio Code. Part of their reason is likely what's causing you trouble: the plugin that makes everything function hasn't been updated for more than two years. It's a very hit or miss thing. For some people it works great and for others it's non-stop issues.

    https://forum.unity.com/threads/update-on-the-visual-studio-code-package.1302621/

    .NET (and Mono which is an open source implementation of .NET) is the scripting framework used by Unity.

    https://en.wikipedia.org/wiki/.NET
    https://en.wikipedia.org/wiki/Mono_(software)

    OmniSharp is a collection of tools to assist with creating projects for .NET. Visual Studio Code uses it to provide the advanced functionality (ie code completion, syntax highlighting, etc.) that you're having trouble with. Without it it's just a fancy text editor.

    http://www.omnisharp.net/
     
    Last edited: Mar 20, 2023
  4. PinkTreeArts

    PinkTreeArts

    Joined:
    Dec 25, 2021
    Posts:
    11
    Hi everyone... Thanks for your advice.

    So I figured out that the problem is with the C# extension inside VSC.

    It makes sense Unity would drop support for VSC since it's so buggy.

    I googled it and found some forum saying the way to get rid of this stupid "install mono" message is to downgrade the C# extension to version 1.25.0 (I had 1.25.4 before.)

    I did that, and autocomplete worked for a few hours, then crashed again.

    Uninstalled the C# extension. Reinstalled it, redowngraded it (there's no way to install the old version without installing the new version first and then downgrading. Super annoying.) Worked for a while. Then just now it crashed again. Tried the same thing. Still not working.

    Pretty ridiculous that a huge company like Microsoft can't manage to make the plugin that supports coding for one of the biggest game dev platforms out there work.

    At least I know I'm not alone.

    Everything else seems to be working now. I guess I can live without autocomplete, although it really does make life a lot easier.

    Does anybody know of any 3rd party VSC extensions that can do a similar job? I know there's a whole bunch of third party extensions in VSC that say "Unity" but I don't know if any are any good or will do the job of the C# extension.
     
  5. TheSleepyKoala

    TheSleepyKoala

    Joined:
    Aug 24, 2018
    Posts:
    24

    Hi there!

    I created a forked version for the VSC package on Github, which lets users take advantage of c# modern features (AKA useModernNet = true).

    This should solve your problem, and if you run into any issues, I would appreciate it if you open an issue on the repository. :)

    https://github.com/Chizaruu/com.tsk.ide.vscode
     
    icauroboros likes this.
  6. Zenovak

    Zenovak

    Joined:
    Nov 25, 2018
    Posts:
    2
    I'm gonna leave a short answer here. I had the same problem with VS Code. It was so bad with unity, the autocomplete doesn't work, even the language detection doesn't work. Nothing ever works out of the box. I had to dig around with omnisharp. Installing older versions, installing newer versions etc.

    The easy way out of this mess is to just use Visual studio community instead. Works straight out of the box. No headaches.