(一)下载vscode常用插件
Debugger for Unity
Unity Tools
Unity Code Snippets
Debugger for Unity环境配置
(二)安装mono环境
https://www.mono-project.com/download/stable/
安装后输入mono查看是否能找到对应命令
(三)安装dotnet环境
https://dotnet.microsoft.com/download
安装后输入dotnet查看是否能找到对应命令
安装后记得关闭终端,vscode,unity,然后再打开不然会出现下面提示
出现报错 Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable
解决办法:
Got the same issue right now, perhaps occurred after recent MacOS update. Killed vscode, killed Unity. >Restarted Unity, regenerated project files (Unity -> Preferences -> External Tools) then opened vscode from >within Unity (dbclick on any script). Took about a minute for intellisense to kick off but it did eventually. Hope >it helps
(四)测试
完全重启vscode,unity
先后点击vscode调试,再点击unity上面的play,成功断点
参考
https://code.visualstudio.com/docs/other/unity
https://github.com/OmniSharp/omnisharp-vscode/issues/4489
https://docs.unity3d.com/cn/current/Manual/ManagedCodeDebugging.html