便捷的方式在手機上查看Unity3D的Console Log(調試信息 日志)


Logs Viewer

功能描述

Using this tool you can easily check your editor console logs inside the game itself! No need to go back to the project and do any tests to track the problems!

使用此工具,不管在手機或者Unity Editor中,你都可以很容易地檢查/查看游戲輸出的日志,而不需要回到項目和做任何測試跟蹤問題!(開源免費)

功能預覽

在手機上也可以很方便地查看日志,無須打開log文件

開啟方法

All what you have to do is to make a circle gesture using your mouse (click and drag) or your finger (touch and drag) on the mobile screen to show all these logs!

那要怎樣顯示此日志呢?在PC/MAC等桌面平台,你需要使用鼠標按住並畫圈圈,在Mobile平台上,你需要使用手指畫圈圈就可以顯示日志了

設置步驟

To setup log viewer do the following

  1. create reporter from menu (Reporter->Create) at first scene your game start .
  2. then set the ” Scrip execution order ” in (Edit -> Project Settings ) of Reporter.cs to be the highest.

設置步驟

  1. 在游戲的主場景(首次啟動的Scene),點擊菜單欄 ReporterCreate,將會在場景中創建一個Reporter的Gameobject上綁定了ReporterReporterMessageReceiver腳本
  2. 點擊 EditProject SettingsScrip Execution Order,在打開的MonoManager中,點擊+號,添加Reporter

開源免費

AssetStore: https://www.assetstore.unity3d.com/en/#!/content/12047

GitHub: https://github.com/aliessmael/Unity-Logs-Viewer/

插件自帶的文檔:導入資源后在 Reporter/Documentation/index.html

或參考:https://github.com/zhaoqingqing/blog_samplecode/tree/master/unity_protobuf_sample/Assets/Reporter

改進或建議

本文基於插件的1.6版本 (2016-06-13發布),Unity 5.3.4f1 運行正常。

修改開啟圈數

Reporter 屬性面板,修改 Num of Circle to Sh 的數值為其它,默認為1

開啟時禁用NGUI的輸入

如果想在開啟日志窗口時,禁用NGUI的Input,可以使用添加以下。在ReporterMessageReceiver.cs

void OnHideReporter()
	{
        //TO DO : resume your game
        //NOTE if use ngui enable input
        //if (UICamera.eventHandler != null)
        //{
        //    UICamera.eventHandler.useMouse = true;
        //    UICamera.eventHandler.useTouch = true;
        //}
    }

    void OnShowReporter()
	{
        //TO DO : pause your game and disable its GUI
        //NOTE if use ngui disable input
        //if (UICamera.eventHandler != null)
        //{
        //    UICamera.eventHandler.useMouse = false;
        //    UICamera.eventHandler.useTouch = false;
        //}
    }

其它注意事項

亮兄此文中提到,如果場景是使用Assetbundle加載的話會出現異常,他的處理方式是把用到 string[] scenes ;的地方進行了屏蔽(注釋)

我並沒有詳細測試使用ab場景的情況,我是通過判空來避免異常的出現,查看我的修改:https://github.com/zhaoqingqing/blog_samplecode/commit/f0eb5045cd9aa1bda7efe257647e885f6367ed14

豎屏顯示問題

在豎屏下,默認頂部的按鈕顯示的不完整,但實際上,頂部欄是可以滑動的。

並且在Setting(設置)中是可以放大和縮小字體的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM