简体   繁体   中英

Visual Studio Code intellisense for Unity not working

so I've been trying to get Visual Studio Code set up to work with Unity. Here is the list of extensions I have for Unity: C# version 1.21.17 Debugger for Unity version 2.7.5 Unity Tools version 1.2.3 Unity Code Snippets version 1.3.0

So I have the IntelliSense working for methods like Awake, Start, OnCollisionEnter2D etc., but when I try to get methods like GetComponent they dont show up, which can be quite bothering as I am trying to learn and still dont know thte methods so well as to know all of their parameters and the exact way they are named.

So as it turns out(For some reason), the problem was that even though it appeared that when double clicking a script in Unity opened up the entire project folder in VS Code, I could see all the files and that stuff for some reason that was not properly loaded. I tried reopening the project folder from VS Code, rather than from unity and it all worked out. Now I am able to use IntelliSense to its full extent. Leaving this in case others are struggling with this. Once you've opened up the project folder from vs code, if you leave it open, double clicking scripts from unity will work fine, no need to manually open thtem from vs code everytime you want to edit a script.

Sometimes it happens if you don't set VSCode as the default editor for Unity scripts. In Unity go to Edit > Preferences > External Tools > External script editor and choose Visual Studio Code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM