[英]VSCode integration with Unity 2017.1: IntelliSense not able to suggest any type of data
I just heard that Unity will be dropping support on MonoDevelop on its 2018.1 version and went to search for an alternative.我刚刚听说 Unity 将在其 2018.1 版本上放弃对 MonoDevelop 的支持,并开始寻找替代方案。 VSCode was the best option so I downloaded it and installed all suggested Unity extensions.
VSCode 是最好的选择,所以我下载了它并安装了所有建议的 Unity 扩展。 ( https://code.visualstudio.com/docs/other/unity )
( https://code.visualstudio.com/docs/other/unity )
I also changed my External Script Editor to Code.我还将我的外部脚本编辑器更改为代码。 I've created a new Unity project for testing.
我创建了一个新的 Unity 项目进行测试。 The code snippets are working great for unity methods such as Start () and Update () but whenever I try to declare a variable like:
代码片段非常适用于诸如 Start () 和 Update () 之类的统一方法,但是每当我尝试声明一个变量时,例如:
private Rigidbody rb;
The rigid body is not suggested.不建议刚体。 I decided to test with other data types, the most essentials like int, float, etc. And none of them are suggested either.
我决定用其他数据类型进行测试,最重要的数据类型,如 int、float 等。也不建议使用它们。 What could be happening?
会发生什么? Why is IntelliSense not working properly?
为什么 IntelliSense 无法正常工作? I've already downloaded the C# extension as suggested at https://code.visualstudio.com/docs/editor/intellisense
我已经按照https://code.visualstudio.com/docs/editor/intellisense 的建议下载了 C# 扩展
I'm on a Mac using MacOS Sierra with the most current version of VSCode and Unity 2017.1.我在 Mac 上使用 MacOS Sierra 和最新版本的 VSCode 和 Unity 2017.1。
[EDIT] The problem was solved after I reinstalled, MonoDevelop, VisualStudio for Mac, VSCode and all it's extensions and used mad.meesh suggestion of searching the .sln on project opening. [编辑] 在我重新安装 MonoDevelop、VisualStudio for Mac、VSCode 及其所有扩展并使用 mad.meesh 建议在项目打开时搜索 .sln 后,问题解决了。 I still don't understand why, but it's working.
我仍然不明白为什么,但它正在工作。
Old question, but I had the same problem just recently.老问题,但我最近遇到了同样的问题。
There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files.您的Assembly-CSharp.csproj或project-name.sln文件中一定存在问题。 Most likely to be the .csproj file.
最有可能是.csproj文件。 If you take a look at it, you will see various references to .dll files.
如果你看一看,你会看到对.dll文件的各种引用。
You can tell Unity (my version: v2019.2.20f1 ) to create these for you by enabling Edit > Preferences > Generate all .csproj files .您可以通过启用Edit > Preferences > Generate all .csproj files告诉 Unity(我的版本: v2019.2.20f1 )为您创建这些文件。
This fixed my issue.这解决了我的问题。
I followed the tutorial from Microsoft for VS Code with Unity and it seemed to finally do the trick... https://code.visualstudio.com/docs/other/unity我跟着微软的 VS Code with Unity 教程,它似乎终于成功了...... https://code.visualstudio.com/docs/other/unity
Steps I took:我采取的步骤:
Hope this helps!希望这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.