unity另外一种debug的方法

转载自:http://blog.csdn.net/setflvet/article/details/8102586

懒得自己再写了。这种方法的前两步一般都是Unity默认的,不用去管。关键是第三步和第五步。要在MonoDevelop中,选择【Tools】-【Options...】,在【Unity】-【Debugger】选项卡中的【Editor Location】中设置Unity3D的所在路径,并勾选【Launch Unity Automatically】和【Editor Location】。要在调试前关闭unity,由调试器打开Unity。

Unity3D 3.0版本开始,支持使用MonoDevelop调试,本文所使用的是Unity3D 3.5.5f3。


一、下载并安装Unity3D(3.0以上版本)以及内置的MonoDevelop(安装Unity3D时勾上即可,如图1),记得是内置的MonoDevelop,MonoDevelop官方下载的版本是没有Unity3D调试插件的。

图1-勾选MonoDevelop

unity另外一种debug的方法_第1张图片


二、设置Unity3D。在Unity3D中,选择【Edit】-【Preferences...】,在【External Tools】选项卡中的【External Script Editor】设置为【MonoDevelop (built-in)】。

图2-设置Unity3D

unity另外一种debug的方法_第2张图片


三、设置MonoDevelop。在MonoDevelop中,选择【Tools】-【Options...】,在【Unity】-【Debugger】选项卡中的【Editor Location】中设置Unity3D的所在路径,并勾选【Launch Unity Automatically】和【Editor Location】。

图3-设置MonoDevelop

unity另外一种debug的方法_第3张图片


四、在Unity3D-Project里右键要调试的代码,在弹出的菜单中选择【Sync MonoDevelop Project】,在MonoDevelop里打开项目代码。

图4-MonoDevelop打开代码

unity另外一种debug的方法_第4张图片


五、关闭Unity3D,在MonoDevelop中为代码设置断点,点击调试按钮或按F5进行调试,MonoDevelop就会自动打开Unity3D,此时在Unity3D中点击Play运行,断点就会起作用了。

图5-断点调试

 

你可能感兴趣的:(unity另外一种debug的方法)