(一)下載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查看是否能找到對應命令
(三)安裝dotnet環(huán)境
https://dotnet.microsoft.com/download
安裝后輸入dotnet查看是否能找到對應命令
安裝后記得關閉終端炉菲,vscode助析,unity煮岁,然后再打開不然會出現(xiàn)下面提示
出現(xiàn)報錯 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