如何利用vs2012 debug unity3d

Visual Studio可算是世上最强大的IDE了,最近需要用Unity3D开发2D的游戏,算是做个老虎机(Slot Machine)的小demo来调研Unity3D对于我们项目组的适用性。

既然VS这么牛B,以前也开发过一段时间的WPF程序,对VS也是大爱,今天说下如何利用VS2012来debug unity3d的C#脚本。

1. 打开VS2012, 打开Tools->Extensions and Updates,搜索并下载UnityVS,安装时需关闭VS2012。

unityVS_in_VS2012

2. UnityVS安装完毕后, 去安装目录(举例:C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\2012)下找到Visual Studio 2012 Tools.unitypackage, 复制该文件到Unity安装目录下Standard Packages文件夹下(举例:D:\Unity\Editor\Standard Packages)。

3.打开/重新打开Unity3D程序,右击Asserts->Import Package就会看到Visual Studio 2012 Tools, 点击导入到Asserts中。

vs2012Tools_in_unity3d

4. 在Unity3D中点击Edit->Preferences…->External Tools->External Script Editor,选择UnityVS.OpenFile。此时你双击你之前写的C#脚本就会自己打开VS2012了,并且导入整个工程目录。

unityVS_openFileunityVS_project

5. 返回VS2012,在你的脚本上加断点,并点击Attach to Unity

attach_to_unity

6. 返回Unity3D,运行你的游戏,这时候就进入VS2012的预设断点了。大功告成!!

debug_zambie_game_with_vs2012

转载请注明:ShirlmanBlog » 如何利用vs2012 debug unity3d

请看安装说明安装 很难的的工具 1. If you have previously installed UnityVS uninstall it now, run ccleaner to remove any left over files & registry keys and reboot. 2. Run UnityVS 2012.msi to install UnityVS 3. Run "make Dir.bat" as ADMINISTRATOR, if you see any errors then make sure you have admin rights and run it again. 4. Right click "copy rhino.bat" and choose edit to open it in notepad 5. replace PATH_TO_THIS_DIRECTORY with the directory which you extracted the .bat and "Rhino.Licensing.dll" to. You should end up with something that looks like this 'copy "D:\extracted\Rhino.Licensing.dll" "%SystemRoot%\assembly\GAC_MSIL\Rhino.Licensing\1.2.0.0__0b3305902db7183f"' 6. Save the edit .bat and run it as ADMINISTRATOR, if you get any errors check the file again and make sure it saved correctly. 7. Navigate to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\SyntaxTree\UnityVS" and DELETE the "Rhino.Licensing.dll" File (it should ask you for admin rights to do this) 8. Now move (Cut & paste) the "log4net.dll" file from the current UnityVS Directory to the Visual Studio IDE directory (Go up 3 Directories - "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE") 9. Launch Visual Studio 2012 (If you get any errors from visual studio at this point or after make sure you've followed every step correctly, if you have uninstall UnityVs, uninstall visual studio 2012, run ccleaner for both temp files and the registry then reboot and start again) 10. It should now prompt you for your key, open up the key.txt extracted earlier and copy the contents into the box, it should now enable the OK button, click that and you're done! 11.If you still have errors after installing the crack try changing "1.2.0.0__0b3305902db7183f" to "1.2.0.0__49e34be443e62e2a" in both the make dir.bat and copy rhino.bat files and run them again.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值