2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【unity】VSCodeで保管を機能させる

Posted at

初書:2021/2/14
PC:macOS 10.15.7
unity: 2019.4.20f1

前書き

久々にunityを触ってみた。エディタは少し前にVSCodeに変更していた。
なので、特に問題なく使えるかなーと思って新規csファイルを作成し、
コードを書いてみると、「public」すら予測変換に出てこないではないですか!
ということで設定を見直してみる

monoをインストール

まずはmonoが入っているかを確認。

% mono --version
Mono JIT compiler version 6.10.0.104 (2019-12/5d03a6fe116 Wed Apr 29 20:51:09 EDT 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
// 略

入っていた。
では大丈夫かと思いきやそうでもなかった。
調べるとhomebrewで入れようと書いていたので、brew listで入れていたのかチェックすると、リストに存在していなかった。
which monoをしてみると、/Library/Frameworks/Mono.framework/Versions/Current/Commands/monoと出たので、
おそらくVisual Studio for Macが入れたものだろう。

ということでbrewからインストール。

% brew install mono
...
Error: The `brew link` step did not complete successfully
...
==> Caveats
To use the assemblies from other formulae you need to set:
  export MONO_GAC_PREFIX="/usr/local"
==> Summary
🍺  /usr/local/Cellar/mono/6.12.0.90: 3,992 files, 428.1MB

インストールはできるものの、リンクがうまく行ってなさそう。
.zshrcにexport MONO_GAC_PREFIX="/usr/local"を追加し、再起動してみたが特に変化が無かったのでリンクはうまく行ってない。まあunity以外でC#扱わないしいいや、、

monoをVSCodeに認識してもらう

あとはvscode側に先程インストールしたmonoを認識してもらう。
コマンドパレットからPreferences: Open Settings (JSON)を入力してsetting.jsonを開き、以下を追加する

    "omnisharp.useGlobalMono": "always",
    "omnisharp.monoPath": "/usr/local/Cellar/mono/6.12.0.90",

omnisharp.monoPathはインストールされたバージョンを指定すること。インストール時のSummaryに書いてある。

これで保存すると、予測変換が出るようになった。

終わりに

安定感はVisual Studio for Macの方が良いのだが、何せ重い…
VSCode一択になるような環境構築が出来る様になるといいな…

参考サイト

MacでVSCodeがうまくUnityのコードを補完してくれないとき - Qiita

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?