(一)下載vscode常用插件
Debugger for Unity
Unity Tools
Unity Code Snippets
Debugger for Unity環(huán)境配置






(二)安裝mono環(huán)境
https://www.mono-project.com/download/stable/
安裝后輸入mono查看是否能找到對(duì)應(yīng)命令
(三)安裝dotnet環(huán)境
https://dotnet.microsoft.com/download
安裝后輸入dotnet查看是否能找到對(duì)應(yīng)命令
安裝后記得關(guān)閉終端,vscode,unity,然后再打開不然會(huì)出現(xiàn)下面提示
出現(xiàn)報(bào)錯(cuò) 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
(四)測(cè)試
完全重啟vscode,unity
先后點(diǎn)擊vscode調(diào)試,再點(diǎn)擊unity上面的play,成功斷點(diǎn)

參考
https://code.visualstudio.com/docs/other/unity
https://github.com/OmniSharp/omnisharp-vscode/issues/4489
https://docs.unity3d.com/cn/current/Manual/ManagedCodeDebugging.html