0
1

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からC#のファイルをVscodeで開いても補完機能が効いていなかったので効くようにした

Last updated at Posted at 2020-10-10

C#の補完機能が効いていない

Vscodeの拡張で、下記を入れていたが補完が効いていなかった。

  • C#
  • Debugger for Unity

そのため、以下の記事を参考にさせていただきながら補完を効くように作業しました。
ほぼ記事内容をなぞっただけですが、備忘させてください...
超絶謝謝参考記事: UnityでVSCodeを使うための最低限必要な設定

homebrewのインストール

以下URLからコードコピってきて、terminalに貼り付けて、homebrewのインストール
https://brew.sh/index_ja

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

インストールできたか確認。

brew -v
Homebrew 2.5.5
Homebrew/homebrew-core (git revision 62667b; last commit 2020-10-10)

入った。

Monoのインストール

brew install mono

ログを見てもSUCCESS的なの出てなくて、完了したか分からなかったのでversion確認してみる

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)

入ってる。

.NET CLI toolsのインストール

上記からダウンロードしてインストール。

Vscodeの拡張機能をインストール

以下三つ

  • C#
  • Debugger for Unity
  • Mono Debug

Mono Debugだけインストールしていなかったので、新たにインストール
mono-install.png

Unity上でVscodeを標準エディタに設定する

メニューバーから、
Preferences > External Tools > External Script Editor
の箇所を、Visual Studio Codeにする。
Visual Studio Codeがプルダウンに出いていない場合、Browseから検索。

Unity-settings.png

Vscodeを再度確認

一応再起動して、VscodeでC#のファイルを開く。

C#-script.png

int型の変数に、float型の変数を代入しようとしてみると、
電球が出た!!!
やりました。ありがとうございます捗ります。

気になる箇所二点

1. VscodeでC#のファイルを開いた時に、右下にerrorが出る。

net-error.png

The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.

.NETをインストールしたから出ないと思ったの出てきた。
気になる。
下記記事を参考に出ないようにしました。
VSCodeで「The .NET Core SDK cannot be located.」メッセージを抑止

2. 変数,関数の宣言をしたコードの上にreferencesが出てくる

Screen Shot 2020-10-10 at 18.53.56.png

邪魔だなと思ったので下記記事を参考にさせて頂き、非表示に
Visual Studio CodeのReference informationを非表示にする方法

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?