能够今后连接下载最新的unity package: android
或者从unity asset store下载:https://www.assetstore.unity3d.com/en/#!/content/104658ios
- 支持多平台(unity editor, exe, Android, iOS, WP...).
- 一键开关日志(开发模式时开启日志,发布模式时一键关闭).
- 是否将日志打印到屏幕(即使不链接Android studio,xcode也能够查看日志)
- 是否记录日志到text(默认路径是persistentdatapath,能够在程序崩溃时查看日志)
- 自动将时间戳添加到日志.
- 屏幕显示堆栈信息或记录堆栈信息到text.
- 全部功能都在一个dll中,能够直接复制到工程使用.
Debuger.EnableHiDebugLogs(true);
若是使用Debuger.Log or Debuger.LogWarnning or Debuger.LogError打印日志, 你能够一键关闭这些日志Debuger.EnableHiDebugLogs(false).git
同时,也会自动将你的日志附加时间戳.github
固然你倾向使用unity引擎的Debug.Log打印日志,这些日志一样能够打印在屏幕上或记录到txt中.xcode
Debuger.EnableOnText(true);
将会记录日志和堆栈信息到text,默认路径是Application.persistentDataPath.字体
Debuger.EnableOnScreen(true);
将会显示一个按钮,能够拖拽到任何地方(不遮挡你的游戏按钮的地方)this
当点击这个按钮,将会弹出一个面板展现日志和堆栈.debug
- 点击每一条日志能够显示其堆栈信息.
- 勾选 log 或 warnning 或 error 只显示此类型的日志.
- 清空屏幕上的全部日志.
- 关闭日志展现面板
- 设置屏幕上字体大小.
void Start() { Use_Debug(); Use_Debuger(); } /// <summary> /// use debuger, you can enable or disable logs just one switch /// and also it automatically add time to your logs /// </summary> void Use_Debuger() { //you can set all debuger's out put logs disable just set this value false(pc,android,ios...etc) //it's convenient in release mode, just set this false, and in debug mode set this true. Debuger.EnableHiDebugLogs(true); //Debuger.EnableHiDebugLogs(false); Debuger.EnableOnText(true); Debuger.EnableOnScreen(true); for (int i = 0; i < 100; i++) { Debuger.Log(i); Debuger.LogWarning(i); Debuger.LogError(i); } } /// <summary> /// if you donnt want use Debuger.Log()/Debuger.LogWarnning()/Debuger.LogError() /// you can still let UnityEngine's Debug on your screen or write them into text /// </summary> void Use_Debug() { Debuger.EnableOnText(true); Debuger.EnableOnScreen(true); for (int i = 0; i < 100; i++) { Debug.Log(i); Debug.LogWarning(i); Debug.LogError(i); } }
[SerializeField] private bool _isLogOn;//set this value from inspector [SerializeField] private bool _isLogOnText; [SerializeField] private bool _isLogOnScreen; // Use this for initialization void Start() { Debuger.EnableHiDebugLogs(_isLogOn); Debuger.EnableOnText(_isLogOnText); Debuger.EnableOnScreen(_isLogOnScreen); for (int i = 0; i < 100; i++) { Debuger.Log(i); Debuger.LogWarning(i); Debuger.LogError(i); } Debuger.FontSize = 20;//set size of font }
使用unity引擎的Debug.Log, 仍然能够打印日志到屏幕,或者记录到text.3d
[SerializeField] private bool _isLogOnText; [SerializeField] private bool _isLogOnScreen; // Use this for initialization void Start() { Debuger.EnableOnText(_isLogOnText); Debuger.EnableOnScreen(_isLogOnScreen); //unity engine's debug.log for (int i = 0; i < 100; i++) { Debug.Log(i); Debug.LogWarning(i); Debug.LogError(i); } }
support: hiramtan@live.com日志
qq群:83596104