一、下载VSCode
https://code.visualstudio.com/
二、VSCode C#配置:
安装 .net core SDK
下载 .NET(Linux、macOS 和 Windows)
这里要注意一点(虽然好像6.0的版本也什么没问题):
4.7.1是符合的版本
安装:
三、安装C#插件
-
C#
-
Auto-Using for C#
四、创建工程(调试)
-
从 C:\Program Files\dotnet 路径打开终端 cmd
-
dotnet new console -o 项目路径 (eg:dotnet new console -o D:\cs_project)
-
code .
-
弹出VSCode界面
-
在VSCode终端 ,输入 dotnet run
这里会遇到一个问题
新增启动项目文件报错:Could not execute because the application was not found or a compatible .NET SDK is not installed.
完整错误如下:
Could not execute because the application was not found or a compatible .NET SDK is not installed.`
`Possible reasons for this include:`
`* You intended to execute a .NET program:`
`The application 'new' does not exist.`
`* You intended to execute a .NET SDK command:`
`It was not possible to find any installed .NET SDKs.`
`Install a .NET SDK from:`
`https://aka.ms/dotnet-download
-
问题原因:program file和program file(x86)dotnet命令冲突了
-
解决办法:将 C:/program file(x86)/dotnet/下的dotnet.exe 删除即可
五、VSCode的Unity配置
Visual Studio Code and Unity
六、安装mono
(.net 前面步骤已经完成了)
Download - Stable | Mono
七、在unity中将VSCode设置为默认编辑器:
Edit -> Preferences -> External Tools
External Script Editor选项 , 选VSCode
八、安装插件:
-
Debugger for Unity (会自动安装C#)
-
Chinese(Simplified)(简体中文)
-
Unity Code Snippets
-
Unity Code Snippets Improved
-
Unity Tools
-
Prettier-Code formatter
九、安装运行插件和配置:
-
Code Runner -> 运行插件
-
在设置窗口,搜索run in terminal ,找到Run In Terminal勾选
-
文章来源:https://www.toymoban.com/news/detail-404296.html
-
cd $dir && dotnet run $fileName文章来源地址https://www.toymoban.com/news/detail-404296.html
到了这里,关于VSCode配置(Unity)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!