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:查找匹配关键字的方法

posted @ 2014-04-08 09:46  赵青青  阅读(36327)  评论(17编辑  收藏  举报