VSCode配置(Unity)

一、下载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

八、安装插件:

  1. Debugger for Unity (会自动安装C#)

  2. Chinese(Simplified)(简体中文)

  3. Unity Code Snippets

  4. Unity Code Snippets Improved

  5. Unity Tools

  6. Prettier-Code formatter

九、安装运行插件和配置:

  1. Code Runner -> 运行插件

  2. 在设置窗口,搜索run in terminal ,找到Run In Terminal勾选

  3.  cd $dir && dotnet run $fileName

  • 5
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值