[英]Autocomplete for visual studio code not working for C#/Unity
I have just begun trying to learn C# with Unity.我刚刚开始尝试使用 Unity 学习 C#。 I'm following guides and tutorials.我正在关注指南和教程。 In these guides I see auto completions that my visual studio code is not showing me.在这些指南中,我看到了 Visual Studio 代码未显示的自动完成。
For example, in one video I see the following auto-completion:例如,在一个视频中,我看到以下自动完成:
On my own installation, I see the following:在我自己的安装中,我看到以下内容:
Note that the auto-completion is not hinting Destroy
.请注意,自动完成并不暗示Destroy
。 Other methods/functions such as GetComponent
are also not auto-completed. GetComponent
等其他方法/功能也不会自动完成。
I believe that the correct folder is opened in VSC.我相信在 VSC 中打开了正确的文件夹。
Visual studio code is set as my default editor in unity as per this question .根据这个问题,Visual Studio 代码统一设置为我的默认编辑器。 I have installed the .Net Core Extension Pack
, which includes the C# extension pack for VSC.我已经安装了.Net Core Extension Pack
,其中包括用于 VSC 的 C# 扩展包。 What am I missing?我错过了什么?
Enabling code completion (For recent versions of Unity)启用代码完成(对于最新版本的 Unity)
If you are installing VS Code for the first time, you might be missing targeting packs required for Unity's code-completion (IntelliSense) in VS Code.如果您是第一次安装 VS Code,您可能会缺少 VS Code 中 Unity 的代码完成 (IntelliSense) 所需的目标包。
Targeting pack download links:定位包下载链接:
• Windows: .NET Framework 4.6 Targeting Pack • Windows:.NET 框架 4.6 目标包
Download Link: https://www.microsoft.com/download/details.aspx?id=48136下载链接: https://www.microsoft.com/download/details.aspx?id=48136
• macOS: Download .NET SDK • macOS:下载 .NET SDK
Download link: https://dotnet.microsoft.com/download下载链接: https://dotnet.microsoft.com/download
Steps:脚步:
Reference: https://code.visualstudio.com/docs/other/unity参考: https://code.visualstudio.com/docs/other/unity
install emmet plugin and use ctrl+space keys for auto-completion安装 emmet 插件并使用 ctrl+space 键自动完成
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.