首先下載vscode與unity
在unity中打開Perferences,切換到External Tools犁柜,選擇腳本編輯器為vscode息裸。并勾選全部生成文件列吼。
雙擊Assets面板中的腳本文件乎芳,自動在vscode中打開遵蚜,增加插件C#,下載 .Net
與 Mono
包并安裝奈惑。
.Net下載后吭净,在命令行輸入which dotnet
,如無返回則在/usr/local/bin
創(chuàng)建軟鏈到dotnet安裝路徑肴甸。
Mono下載后寂殉,在vscode的Perferences配置Setting,選擇Extensions的C# configuration雷滋,更改:
- OmniSharp:Use Glogal Mono 設(shè)置為always
- OmniSharp:Mono Path 設(shè)置為 本地Mono安裝路徑, 如"/Library/Frameworks/Mono.framework/Versions/Current"
重啟vscode并從unity中打開便可以看到變量的類型正確顯示文兢,代碼自動補全功能晤斩。
參考鏈接:
Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable.
dotnet-command-not-found
Intellisense is not working in Visual Studio