Unity中Debug的用法
来源:互联网 发布:淘宝网官方下载 编辑:程序博客网 时间:2024/05/18 01:04
UnityEngine.Debug:
Class containing methods to ease debugging while developing a game.
该类中包含了一些便于游戏开发时的调试方法。
Class Variables
static var isDebugBuild : boolean
In the Build Settings dialog there is a check box called "Development Build".
在"Build Settings" 对话框中有一个"Development Build"的选项。
If it is checked isDebugBuild will be true. In the editor isDebugBuild always returns true. It is recommended to remove all calls toDebug.Log when deploying a game, this way you can easily deploy beta builds with debug prints and final builds without.
如果复选框被选择,isDebugBuild则为true。在编辑器中isDebugBuild总是返回true。在游戏发布时,这个命令可以移除所有Debug.Log调用。这样,你就可以轻松地发布带有调试输出的测试版和没有这些调试信息的最终版。
Class Functions
DrawLinestatic function DrawLine (start :Vector3, end :Vector3, color :Color =Color.white, duration : float = 0.0f) : void
Draws a line from the point start to end with color for a duration of time. If duration is 0 then the line is rendered 1 frame.
绘制一条从开始点到结束点的线,需要指定绘线的颜色和持续时间。如果持续时间为0,那么该线只会被渲染1帧。
The line will be drawn in the scene view of the editor. If gizmo drawing is enabled in the game view, the line will also be drawn there.
该线被绘制在编辑器下的Scene窗口中。如果Gimzo绘制方法被开启,那么该线同样会被绘制到Game窗口中。
DrawRaystatic function DrawRay (start :Vector3, dir :Vector3, color :Color =Color.white, duration : float = 0.0f) : void
Draws a line from start to start + dir with color for a duration of time. If duration is 0 then the line is rendered 1 frame.
从开始点绘制一条dir方向和长度的线,需要指定绘线的颜色和持续时间。如果持续时间为0,那么该线只会被渲染1帧。
The line will be drawn in the scene view of the editor. If gizmo drawing is enabled in the game view, the line will also be drawn there.
该线被绘制在编辑器下的Scene窗口中。如果Gimzo绘制方法被开启,那么该线同样会被绘制到Game窗口中。
Breakstatic function Break () : void
Pauses the editor.
使编辑器暂停。
This is useful when you want to check certain values on the inspector and you are not able to pause it manually.
当你想在运行到某种情况下游戏自动暂停下来以方便你查看对象属性面板中的值时,这是非常有用的。
Logstatic function Log (message : object) : void
Logs message to the Unity Console.
将日志信息输出到Unity控制台。
static function Log (message : object, context :Object) : void
Logs message to the Unity Console.
将日志信息输出到Unity控制台。
When you select the message in the console a connection to the context object will be drawn. This is very useful if you want know on which object an error occurs.
当你在控制台中选中调试信息时,Unity将绘制一个调试信息与触发对象之间的连接。当你想知道在哪个对象上发送错误时,这是非常有用的。
LogErrorstatic function LogError (message : object) : void
A variant of Debug.Log that logs an error message to the console.
Debug.Log的一个变种,它将输出一个Erro类型的调试信息到控制台。
static function LogError (message : object, context :Object) : void
A variant of Debug.Log that logs an error message to the console.
Debug.Log的一个变种,它将输出一个Erro类型的调试信息到控制台。
When you select the message in the console a connection to the context object will be drawn. This is very useful if you want know on which object an error occurs.
当你在控制台中选中调试信息时,Unity将绘制一个调试信息与触发对象之间的连接。当你想知道在哪个对象上发送错误时,这是非常有用的。
Warningstatic function LogWarning (message : object) : void
A variant of Debug.Log that logs a warning message to the console.
Debug.Log的一个变种,它将输出一个Warning类型的调试信息到控制台。
static function LogWarning (message : object, context : Object) : void
A variant of Debug.Log that logs a warning message to the console.
Debug.Log的一个变种,它将输出一个Warning类型的调试信息到控制台。
When you select the message in the console a connection to the context object will be drawn. This is very useful if you want know on which object a warning occurs.
当你在控制台中选中调试信息时,Unity将绘制一个调试信息与触发对象之间的连接。当你想知道在哪个对象上发送错误时,这是非常有用的。
Unity调试方法:
1.安装Unity3D安装包内置的MonoDevelop,MonoDevelop官方下载的版本是没有Unity3D 的调试插件的。
2.打开Unity ,选择Edit –> Preference ,设置外部编辑器为MonoDevelop 。
3.运行MonoDevelop(如果MonoDevelop不能运行,则需要安装 .Net 3.5 ),选择菜单(Tools –> Preference) 打开选项设置窗口,在左边的导航窗口的最后一个节点(Unity –> Debugger),在右边设置Editor Location为正确的位置(即Unity.exe执行文件Path),然后勾选Launch Unity Automatically和Build Project in MonoDevelop ,按OK按钮保存。
4.在Unity Editor的Project窗口点击鼠标右键,在弹出菜单中选择Sync MonoDevelop Project(或者选择菜单栏中的Assets -> Sync MonoDevelop Project),将自动运行MonoDevelop并打开对应的项目。
5.在MonoDevelop中编程、为源代码设置断点(F9),关闭Unity Editor,击调试按钮(F5)开始调试,在自动打开的Unity Editor中点击Play按钮,断点就开始起作用了。
6.MonoDevelop的调试需要完成本帧所有调试才能返回给Unity,即调试中途Unity Scene的信息将不会更新。
- Unity中Debug的用法
- Unity中Instantiate的用法
- 在Unity中Debug.log和Print的区别
- MyEclipse中debug用法
- Vivado中debug用法
- 【Unity】Unity中xml的简单用法笔记
- 关于Unity中协同的用法
- Unity中Bounce Intensity的用法
- 总结Unity 中[XXX]的用法
- 简述unity中Destory的用法
- unity中BringWindowToFront和dragWindow的用法
- Unity中射线的用法小结
- Unity中SendMessage/SendMessageUpwards/BroadcastMessage的用法
- Unity Debug
- unity另外一种debug的方法
- Unity管理Debug.log输出的Log
- 重新定制 Unity引擎的Debug 输出
- Unity print 与Debug.Log 的区别
- python核心编程第二版第八章学习笔记
- jQuery.extend 函数详解
- Oracle Merge into使用小节(一)
- iPhone SE2再爆黑科技,高配置组合!搭配双卡双待?
- 关于.NET编译的目标平台(AnyCPU,x86,x64)
- Unity中Debug的用法
- Unicode转成中文
- 机器学习实战之一---简单讲解决策树
- Unity计时器(二)
- java8中Collectors的学习
- Python海量数据处理之_单机优化
- mysql存储过程的简单使用
- 博客怎么才能在百度页面搜索到?
- 2017.12.20