1.下载好vscode,Edit>Preferences>External Tools>Externale Srcipt Editor 选择VSCode,没有的话点Browse找到vscdoe的exe.
2.VSCode扩展里面下载C#扩展以及Debugger for Unity.
3.这时我的vscode右下角弹出一个警告:
he .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.
以及无法显示代码提示,当时照着网上很多解决方案做都不行,包括下载.Net 4.7.1Framework,甚至把4.8和5.0的也都下载了,最后才找到解决办法.
4.解决方法:
https://dotnet.microsoft.com/en-us/download
直接下载.Net 6.0
而不是根据自己unity项目里面 csproj文件里写的Target去下载
其实需要下载对应的Framework
5.最后效果:
6.使用VSCode打开项目的时候需要等几秒钟,才能显示代码提示,估计是VSCode在记载.
7.PS:代码变色使用的Theme设置的Theme