LogViewer-Unity日志的插件

LogViewer是一款免费且好用的Unity在手机上查看日志的插件:
AssetStore地址:https://assetstore.unity.com/packages/tools/log-viewer-12047
GitHub地址:https://github.com/aliessmael/Unity-Logs-Viewer
CSDN地址:https://download.csdn.net/download/qq_39710961/10451607

1、安装

本人推荐使用UnityAssetStore插件导入的方式:
LogViewer-Unity日志的插件_第1张图片

2、编译报错

导入Unity之后,Unity较高版本会报如下错误:
Assets/Unity-Logs-Viewer/Reporter/Reporter.cs(2013,47): error CS0619: UnityEngine.RuntimePlatform.OSXWebPlayer' is obsolete: WebPlayer export is no longer supported in Unity 5.4+. Assets/Unity-Logs-Viewer/Reporter/Reporter.cs(2013,103): error CS0619: UnityEngine.RuntimePlatform.WindowsWebPlayer' is obsolete: WebPlayer export is no longer supported in Unity 5.4+.''
这是因为Unity5.4+之后,UnityEngine.RuntimePlatform.OSXWebPlayer和UnityEngine.RuntimePlatform.WindowsWebPlayer已经废弃,修改代码如下:

// 修改如下
if (Application.platform != RuntimePlatform.OSXPlayer && Application.platform != RuntimePlatform.WindowsPlayer)

3、使用

点击菜单栏Reporter->create,会生成Reporter的gameObject,并且绑定了Reporter.cs和ReporterMessageReceiver.cs脚本,运行场景,并且点击鼠标左键在Game视图中画圆,就会看到如下效果:
LogViewer-Unity日志的插件_第2张图片
这样就可以时时查看日志了

4、一些有用的设置

LogViewer-Unity日志的插件_第3张图片

Reporter.cs中还有

//手势判断
bool isGestureDone()
//双击判断
bool isDoubleClickDone()
//在Update中是判断手势打开窗口,可将isGestureDone换成isDoubleClickDone,换成双击打开,或者自己实现
if (!show && isGestureDone()) {
	doShow();
}

注意:原代码的isDoubleClickDone存在Bug,可自己查看代码并修改。

你可能感兴趣的:(Unity)