适用于Unity的Visual Studio Code intellisense无法正常工作 [英] Visual Studio Code intellisense for Unity not working

查看:91
本文介绍了适用于Unity的Visual Studio Code intellisense无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在尝试将Visual Studio Code设置为与Unity一起使用.这是我为Unity扩展的列表:C#版本1.21.17Unity版本2.7.5的调试器Unity Tools版本1.2.3Unity代码段1.3.0版

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

所以我让IntelliSense用于Awake,Start,OnCollisionEnter2D等方法,但是当我尝试获取诸如GetComponent之类的方法时,它们却没有显示出来,这在我尝试学习并且仍然不了解的时候可能会很麻烦.方法,以至于知道它们的所有参数以及它们的确切命名方式.

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.

推荐答案

因此,由于某种原因,问题是即使双击Unity中的脚本打开了整个项目文件夹,问题仍然存在.在VS Code中,由于某种原因,我可以看到所有文件以及那些没有正确加载的东西.我尝试从VS Code重新打开项目文件夹,而不是从统一打开它,所有步骤都解决了.现在,我可以完全使用IntelliSense了.万一其他人为此苦苦挣扎,就任由它解决.从vs代码打开项目文件夹后,如果将其保持打开状态,则双击统一脚本可以很好地工作,无需每次想编辑脚本时都从vs代码中手动打开项目.

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.

这篇关于适用于Unity的Visual Studio Code intellisense无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆