Unity使用 UnityVS+VS2013 調試腳本


好消息:UnityVS免費啦

好消息:微軟收購了UnityVS公司,UnityVS免費啦

下載地址:https://marketplace.visualstudio.com/items?itemName=SebastienLebreton.VisualStudio2015ToolsforUnity

官網:https://www.visualstudio.com/features/unitytools-vs

官方文檔:http://unityvs.com/documentation/configuration/

--------------------------------- 更新於 2014-07-30--------------------------------------------------------

好消息:Unity5.2內置集成UnityVS

Unity5.2及之后的版本,不需要往Unity中導入Unityvs插件,安裝完unityvs之后在Unity中設置使用visual studio打開腳本,就可以進行調試,nice。

文檔:Native support for VSTU 2.1 in Unity 5.2

 

Checklist

Let's go over the steps one more time:

  • Install Visual Studio and the Visual Studio Tools for Unity 2.1.
  • In Unity, delete the UnityVS folder if you were previously working with VSTU in an older Unity.
  • In Unity, set Visual Studio to be the external script editor.
  • In Unity, check that the native VSTU support is enabled in the About Unity window.

 

When you're done with the checklist, opening files in Unity will open Visual Studio where you'll be able to debug your Unity project right away.

---------------------------------- 更新於 2016-01-26 --------------------------------------------------------

VS調試Unity

工具原料

UnityVS版本:UnityVS_1.8.2

VS版本:VS2013/VS2015

Unity3D版本:4.3.4或Unity5.x

下載好的文件如下圖所示:

wps_clip_image-23783

 

安裝步驟

1.如果之前安裝過其它版本的UnityVS,請先卸載

2.運行UnityVS 2013.msi

3.找到你安裝visual studio 2013的目錄。

(xxx\Microsoft Visual Studio12.0\Common7\IDE\Extensions\SyntaxTree\UnityVS) 。

例如我是安裝在

D:\ProgramFiles(x86)\MicrosoftVisualStudio12.0\Common7\IDE\Extensions\SyntaxTree\UnityVS

4.把SyntaxTree.VisualStudio.Packages.dll拷貝到步驟3....\UnityVS文件夾中

5.啟動vs2013

6.彈出一個窗口,復制UnityVS中key.txt的內容進去或打開Tools/UnityVS/ Linces Manager

wps_clip_image-13362

7.打開unity,右鍵Assets——Import package——Unity vs 2013

wps_clip_image-15388

 

啟動調試

1. 在Unity中設置使用UnityVS打開腳本(UnityVS.openFile)

wps_clip_image-31668

2、生成UnityVS調試解決方案 UnityVS/Generate Project Files

wps_clip_image-29910

3、選中要調試的腳本,點擊UnityVS/Open In UnityVS

4、默認會打開VS進入調試(如果未打開進入VS,則手動用VS打開UnityVS開頭的解決方案),打開VS后,在VS中設置斷點

wps_clip_image-26589

2. 在VS中按F5啟動調試,會提示生成成功

image

調試效果

3. 回到Unity,點擊Play,如果進入斷點會自動進入到VS調試

image

VS調試快捷鍵

F11 一行一行執行

F10 每一句都執行

Shitf +F11 跳出

F5 繼續

 

快捷鍵

Ctrl+Shift+M:彈出MonoBehaviour中的方法,可以直接生成方法到指定位置

Ctrl+Shift+Q:查找匹配關鍵字的方法


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM