如何在 Visual Studio Code 中获取 Unity 函数名称的智能感知?

问题描述:

我正在学习有关 Unity 的教程,我看到讲师在编写方法名称时具有智能感知.

I am following a tutorial about Unity and I see that the instructor has intellisense when writes the method's name.

但是我只有类和变量的智能感知,我的意思是像刚体这样的 Unity 类和我自己的变量.

However I have only intellisense with classes and variables, I mean Unity classes like Rigidbody and my own variables.

我还阅读了:自动完成功能在 Visual Studio 中不起作用

如何在 Visual Studio 2017 中为统一

老问题,但我最近也遇到了同样的问题.

Old question, but I had the same problem just recently.

您的 Assembly-CSharp.csprojproject-name.sln 文件中肯定存在问题.最有可能是 .csproj 文件.如果你看一看,你会看到对 .dll 文件的各种引用.

There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files.

您可以通过启用编辑">首选项">生成所有 .csproj 文件"来告诉 Unity(我的版本:v2019.2.20f1)为您创建这些文件.

You can tell Unity (my version: v2019.2.20f1) to create these for you by enabling Edit > Preferences > Generate all .csproj files.

 1. Delete both files.
 2. Enable .csproj file generation.
 3. Double click on a script in Unity.

这解决了我的问题.