UnityAPI.Debug调试 |
版本 |
作者 |
参与者 |
完成日期 |
备注 |
UnityAPI_Debug_V01_1.0 |
严立钻 |
|
2018.09.04 |
|
|
|
|
|
|
#《UnityAPI.Debug调试》发布说明:
++++“UnityAPI.Debug调试”是对UnityAPI中Debug类的剖析和拓展;
#Debug调试 |
#Debug调试
++++A、Description描述
++++B、Static Variables静态变量
++++C、Static Functions静态函数
++++D、Message消息
#A、Description描述 |
++A、Description描述
++++立钻哥哥:当开发一个游戏时,类中的方法方便调试;
#B、Static Variables静态变量 |
++B、Variables变量
++++B.1、developerConsoleVisible 开发人员控制台可见
++++B.2、isDebugBuild 是否调试版本
++++B.3、logger 日志记录器
##B.1、developerConsoleVisible 开发人员控制台可见 |
++B.1、developerConsoleVisible 开发人员控制台可见
++++立钻哥哥:Debug.developerConsoleVisible 开发人员控制台可见;
public static bool developerConsoleVisible; |
++Description描述
++++立钻哥哥:打开或关闭调试控制台;
##B.2、isDebugBuild 是否调试版本 |
++B.2、isDebugBuild 是否调试版本
++++立钻哥哥:Debug.isDebugBuild 是否调试版本;
public static bool isDebugBuild; |
++Description描述
++++在Build Settings对话框中有一个叫做“Development Build”复选框;
++++如果是检查isDebugBuild将是正确的;在编辑器中isDebugBuild总是返回true;当开发一个游戏时建议删除所有的调用调试,这样可以很容易的部署测试构建调试构建调试打印并最终构建;
using UnityEngine; using System.Collections;
public class MyDebugClass : MonoBehaviour{ void MyExample(){ if(Debug.isDebugBuild){ Debug.Log(“立钻哥哥:This is a debug build!”); } } } //立钻哥哥:public class MyDebugClass:MonoBehaviour{} |
##B.3、logger 日志记录器 |
++B.3、logger 日志记录器
++++立钻哥哥:Debug.logger 日志记录器;
public static ILogger logger; |
++Description描述
++++立钻哥哥:获取默认的调试日志;
++++Unity控制台的日志消息使用默认日志记录器;
using UnityEngine; using System.Collections;
public class MyDebugClass : MonoBehaviour{ private static ILogger logger = Debug.logger; private static string kTAG = “立钻哥哥”;
void MyGameMethod(){ logger.Log(kTAG, “立钻哥哥”); Debug.logger.Log(kTAG, “小珏妹妹”); } } //立钻哥哥:public class MyDebugClass:MonoBehaviour{} |
#C、Static Function静态函数 |
++C、Static Function静态函数
++++C.1、Assert() 断言
++++C.2、AssertFormat() 声明格式
++++C.3、Break() 终止
++++C.4、ClearDeveloperConsole() 清除开发人员控制台
++++C.5、DrawLine() 画线
++++C.6、DrawRay() 画射线
++++C.7、Log() 日志
++++C.8、LogAssertion() 日志断言
++++C.9、LogAssertionFormat() 日志断言格式
++++C.10、LogError() 错误日志
++++C.11、LogErrorFormat() 错误日志格式
++++C.12、LogException() 日志异常
++++C.13、LogFormat() 日志格式
++++C.14、LogWarning() 警告日志
++++C.15、LogWarningFormat() 警告日志格式
##C.1、Assert() 断言 |
++C.1、Assert() 断言
++++立钻哥哥:Debug.Assert() 断言;
public static void Assert(bool condition); public static void Assert(bool condition, Object context); public static void Assert(bool condition, object message); public static void Assert(bool condition, object message, Object context); |
++++[condition]:Condition you expect to be true;
++++[context]:Object to with the message applies;
++++[message]:String or object to be converted to string representation for display;
++Description描述
++++立钻哥哥:断言一个条件,当条件为false时输出格式化的错误信息到Unity控制台;
++++LogType.Assert类型信息的记录;
##C.2、AssertFormat() 声明格式 |
++C.2、AssertFormat() 声明格式
++++立钻哥哥:Debug.AssertFormat 声明格式;
public static void AssertFormat(bool condition, string format, params object[] args); public static void AssertFormat(bool condition, Object context, string format, params object[] args); |
++++[condition]:Condition you expect to be true;
++++[format]:A composite format string;
++++[args]:Format arguments;
++++[context]:Object to which the message applies;
++Description描述
++++立钻哥哥:断言一个条件,当条件为false时输出格式化的错误信息到Unity控制台;
##C.3、Break() 终止 |
++C.3、Break() 终止
++++立钻哥哥:Debug.Break 终止;
public static void Break(); |
++Description描述
++++立钻哥哥:暂停编辑器;
++++当想要在面板上检查某些值而不能暂停的时候,该函数是有用的;
using UnityEngine; using System.Collections;
public class MyDebugClass : MonoBehaviour{ void MyExample(){ Debug.Break(); } } //立钻哥哥:public class MyDebugClass:MonoBehaviour{} |
##C.4、ClearDeveloperConsole() 清除开发人员控制台 |
++C.4、ClearDeveloperConsole() 清除开发人员控制台
++++立钻哥哥:Debug.ClearDeveloperConsole 清除开发人员控制台;
public static void ClearDeveloperConsole(); |
++Description描述
++++立钻哥哥:清除开发人员控制台的错误;
##C.5、DrawLine() 画线 |
++C.5、DrawLine() 画线
++++立钻哥哥:Debug.DrawLine 画线;
public static void DrawLine(Vector3 start, Vector3 end, Color color = Color.white, float duration = 0.0f, bool depthTest = true); |
++++[start]:Point in world space where the line should start;
++++[end]:Point in world space where the line should end;
++++[color]:Color of the line;
++++[duration]:How long the line should be visible for;
++++[depthTest]:Should the line be obscured by objects closer to the camera?
++Description描述
++++立钻哥哥:在指定的起点与终点之间画条线;
++++该线条将会显示在编辑器窗口的场景中;如果在游戏视窗打开绘画线框,该线条也会被画在该视图;在可持续的时间内(以秒为单位)该线将在第一次显示后可见;duration值为0表示该线仅显示一帧可见;
++++注意:这仅供调试;编辑线框用Gizmos.DrawLine或Handles.DrawLine代替该方法;
using UnityEngine; using System.Collections;
public class MyDebugClass : MonoBehaviour{ void Update(){ Debug.DrawLine(Vector3.zero, new Vector3(1,0,0), Color.red); } } //立钻哥哥:public class MyDebugClass:MonoBehaviour{}
|
using UnityEngine; using System.Collections;
public class MyDebugClass : MonoBehaviour{ void OnCollisionEnter(Collision collision){ foreach(ContactPoint contact in collision.contacts){ Debug.DrawLine(contact.point, contact.point + contact.normal, Color.green, 2, false); } } } //立钻哥哥:public class MyDebugClass:MonoBehaviour{} |
##C.6、DrawRay() 画射线 |
++立钻哥哥推荐的拓展学习链接(Link_Url):
立钻哥哥推荐的拓展学习链接(Link_Url) |
++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/
++++Cocos2dx面试题:https://blog.csdn.net/VRunSoftYanlz/article/details/78630967
++++CocosStudio快速入门:https://blog.csdn.net/VRunSoftYanlz/article/details/82356839
++++UnityAPI.Rigidbody刚体:https://blog.csdn.net/VRunSoftYanlz/article/details/81784053
++++UnityAPI.Material材质:https://blog.csdn.net/VRunSoftYanlz/article/details/81814303
++++UnityAPI.Android安卓:https://blog.csdn.net/VRunSoftYanlz/article/details/81843193
++++UnityAPI.AndroidJNI安卓JNI:https://blog.csdn.net/VRunSoftYanlz/article/details/81879345
++++UnityAPI.Transform变换:https://blog.csdn.net/VRunSoftYanlz/article/details/81916293
++++UnityAPI.WheelCollider轮碰撞器:https://blog.csdn.net/VRunSoftYanlz/article/details/82356217
++++U3D小项目参考:https://blog.csdn.net/vrunsoftyanlz/article/details/80141811
++++Unity案例(Vehicle):https://blog.csdn.net/VRunSoftYanlz/article/details/82355876
++++JSON数据结构:https://blog.csdn.net/VRunSoftYanlz/article/details/82026644
++++HTC_VIVE开发基础:https://blog.csdn.net/VRunSoftYanlz/article/details/81989970
++++Unity5.x用户手册:https://blog.csdn.net/VRunSoftYanlz/article/details/81712741
++++Unity面试题ABC:https://blog.csdn.net/vrunsoftyanlz/article/details/78630687
++++Unity面试题D:https://blog.csdn.net/VRunSoftYanlz/article/details/78630838
++++Unity面试题E:https://blog.csdn.net/vrunsoftyanlz/article/details/78630913
++++Unity面试题F:https://blog.csdn.net/VRunSoftYanlz/article/details/78630945
++++Lua快速入门篇(Xlua拓展):https://blog.csdn.net/VRunSoftYanlz/article/details/81173818
++++Lua快速入门篇(XLua教程):https://blog.csdn.net/VRunSoftYanlz/article/details/81141502
++++Lua快速入门篇(基础概述):https://blog.csdn.net/VRunSoftYanlz/article/details/81041359
++++框架知识点:https://blog.csdn.net/VRunSoftYanlz/article/details/80862879
++++游戏框架(UI框架夯实篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80781140
++++游戏框架(初探篇):https://blog.csdn.net/VRunSoftYanlz/article/details/80630325
++++设计模式简单整理:https://blog.csdn.net/vrunsoftyanlz/article/details/79839641
++++专题:设计模式(精华篇):https://blog.csdn.net/VRunSoftYanlz/article/details/81322678
++++UML类图:https://blog.csdn.net/vrunsoftyanlz/article/details/80289461
++++Unity知识点0001:https://blog.csdn.net/vrunsoftyanlz/article/details/80302012
++++Unity知识点0008:https://blog.csdn.net/VRunSoftYanlz/article/details/81153606
++++U3D_Shader编程(第一篇:快速入门篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80372071
++++U3D_Shader编程(第二篇:基础夯实篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80372628
++++Unity引擎基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78881685
++++Unity面向组件开发:https://blog.csdn.net/vrunsoftyanlz/article/details/78881752
++++Unity物理系统:https://blog.csdn.net/vrunsoftyanlz/article/details/78881879
++++Unity2D平台开发:https://blog.csdn.net/vrunsoftyanlz/article/details/78882034
++++UGUI基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78884693
++++UGUI进阶:https://blog.csdn.net/vrunsoftyanlz/article/details/78884882
++++UGUI综合:https://blog.csdn.net/vrunsoftyanlz/article/details/78885013
++++Unity动画系统基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78886068
++++Unity动画系统进阶:https://blog.csdn.net/vrunsoftyanlz/article/details/78886198
++++Navigation导航系统:https://blog.csdn.net/vrunsoftyanlz/article/details/78886281
++++Unity特效渲染:https://blog.csdn.net/vrunsoftyanlz/article/details/78886403
++++Unity数据存储:https://blog.csdn.net/vrunsoftyanlz/article/details/79251273
++++Unity中Sqlite数据库:https://blog.csdn.net/vrunsoftyanlz/article/details/79254162
++++WWW类和协程:https://blog.csdn.net/vrunsoftyanlz/article/details/79254559
++++Unity网络:https://blog.csdn.net/vrunsoftyanlz/article/details/79254902
++++C#事件:https://blog.csdn.net/vrunsoftyanlz/article/details/78631267
++++C#委托:https://blog.csdn.net/vrunsoftyanlz/article/details/78631183
++++C#集合:https://blog.csdn.net/vrunsoftyanlz/article/details/78631175
++++C#泛型:https://blog.csdn.net/vrunsoftyanlz/article/details/78631141
++++C#接口:https://blog.csdn.net/vrunsoftyanlz/article/details/78631122
++++C#静态类:https://blog.csdn.net/vrunsoftyanlz/article/details/78630979
++++C#中System.String类:https://blog.csdn.net/vrunsoftyanlz/article/details/78630945
++++C#数据类型:https://blog.csdn.net/vrunsoftyanlz/article/details/78630913
++++Unity3D默认的快捷键:https://blog.csdn.net/vrunsoftyanlz/article/details/78630838
++++游戏相关缩写:https://blog.csdn.net/vrunsoftyanlz/article/details/78630687
++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/
--_--VRunSoft:lovezuanzuan--_--