LoginSignup
17
18

More than 5 years have passed since last update.

Unity プロジェクトを Visual Studio でデバッグ(ステップ実行等)

Posted at

導入にちょっとハマったのでまとめておく。

環境の前提

  • Unity がインストールされていること
  • Visual Studio 2010,2012,2013,2015 のいずれかがインストールされていること

Visual Studio Tools for Unity 導入

https://msdn.microsoft.com/ja-jp/dn833194.aspx
この中から手元の Visual Studio のバージョンにあったインストーラを入手

web.png

Unity 側設定:パッケージのインポート

  1. プロジェクトを開く
  2. Assets - Import Package - Visual Studio xxxx Tools メニューを選択

unityvs0.png

インポートに成功すれば、「Visual Studio Tools」メニューが増える。

unityvs2.png

Unity プロジェクトから Visual Studio を開く

Visual Studio Tools - Open in Visual Studio メニューを選択すると、Visual Studio が立ち上がる。

unityvs3.png

Visual Studio から Unity プロセスにアタッチする

DEBUG - Attach Unity Debugger メニューを選択すると、任意の Unity プロセスにデバッガをアタッチすることができる。

vs0.png

vs1.png

vs2.png

ブレークポイント設定

ソースコードの左端をクリックしてブレークポイント設定。
vs3.png

ブレークポイントの行が実行される直前で中断され、ステップ実行したりウォッチウィンドウ見れるようになったりする。
vs4.png

おしまい

脱 MonoDevelop !!!!! ⊂二二二( ^ω^)二⊃

17
18
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
17
18