Mac VSCode開發(fā)Unity環(huán)境搭建

折騰了兩天,終于解決了VSCode開發(fā)Unity不會代碼自動補(bǔ)全的問題,本來就不熟悉Unity相關(guān)的api,如果不能自動補(bǔ)全簡直就是勸退。中途有嘗試Visual Studio,然并卵,翻了一堆的網(wǎng)頁,終于總結(jié)出了最簡單的配置過程。

配置后的效果如下:

image

1.安裝Unity

2.下載安裝.Net Core SDK

image

https://dotnet.microsoft.com/download/dotnet-core/3.1

`?  ~ dotnet --version``3.1.402`

3.下載安裝Mono SDK

image

https://www.mono-project.com/download/stable/

`?  ~ mono --version``Mono JIT compiler version 6.12.0.93 (2020-02/620cf538206 Tue Aug 25 14:04:52 EDT 2020)``Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com` `TLS:` `SIGSEGV:       altstack` `Notification:  kqueue` `Architecture:  amd64` `Disabled:      none` `Misc:          softdebug` `Interpreter:   yes` `LLVM:          yes(610)` `Suspend:       hybrid` `GC:            sgen (concurrent by default)`

4.安裝VSCode

4.1 安裝VSCode插件

`C#``C# Extensions``C# FixFormat Fixed``Debugger for Unity``Unity Tools``Unity Code Snippets``Unity Snippets`

4.2 VSCode配置omnisharp路徑

如果不配置這個,確實可以開發(fā)了,但是各種類型不認(rèn),一片紅
image

設(shè)置路徑:

Code -> Preferences -> Settings, 檢索mono, 點擊settings.json
image
image

配置omnisharp(很重要)

"omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono",``"omnisharp.useGlobalMono": "always"`

設(shè)置.zshrc/.bash_profile環(huán)境變量(很重要)

export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current`

5.設(shè)置Unity代碼編輯器

image

現(xiàn)在就可以各種愉快的開發(fā)Unity了~

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容