Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Unity-Logs-Viewer
Using this tool you can easily check your editor console logs inside the game itself!
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!
Using this tool you can easily check your editor console logs inside the game itself!
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!

This fork works for Unity 5.3+

You can download latest release from unity asset store
https://www.assetstore.unity3d.com/en/#!/content/12047
28 changes: 14 additions & 14 deletions Reporter/Reporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//using System;
using System.Collections;
using System.Collections.Generic;

using UnityEngine.SceneManagement;


[System.Serializable]
Expand Down Expand Up @@ -115,7 +115,7 @@ public float GetMemoryUsage()
public bool show = false ;
//collapse logs
bool collapse ;
//to deside if you want to clean logs for new loaded scene
//to decide if you want to clean logs for new loaded scene
bool clearOnNewSceneLoaded ;

bool showTime ;
Expand Down Expand Up @@ -169,7 +169,7 @@ public float TotalMemUsage{
}
float gcTotalMemory ;
public string UserData = "";
//fram rate per seconds
//frame rate per seconds
public float fps ;
public string fpsText ;

Expand All @@ -193,7 +193,7 @@ enum DetailView
//used to check if you have In Game Logs multiple time in different scene
//only one should work and other should be deleted
static bool created = false ;
//public delegate void OnLogHandler( string condition, string stacktrace, LogType type );
//public delegate void OnLogHandler( string condition, string stack-trace, LogType type );
//public event OnLogHandler OnLog ;

public Images images;
Expand Down Expand Up @@ -282,7 +282,7 @@ void addSample(){
Sample sample = new Sample();
sample.fps = fps ;
sample.fpsText = fpsText ;
sample.loadedScene = (byte)Application.loadedLevel ;
sample.loadedScene = (byte)SceneManager.GetActiveScene().buildIndex;
sample.time = Time.realtimeSinceStartup ;
sample.memory = gcTotalMemory ;
samples.Add( sample );
Expand All @@ -301,8 +301,8 @@ public void Initialize()
catch( System.Exception e ){
Debug.LogException( e );
}
scenes = new string[ Application.levelCount ];
currentScene = Application.loadedLevelName;
scenes = new string[ SceneManager.sceneCountInBuildSettings ];
currentScene = SceneManager.GetActiveScene().name;
DontDestroyOnLoad( gameObject );
#if USE_OLD_UNITY
Application.RegisterLogCallback (new Application.LogCallback (CaptureLog));
Expand All @@ -322,7 +322,7 @@ public void Initialize()
}


//initialize gui and styles for gui porpose
//initialize gui and styles for gui purpose

clearContent = new GUIContent("",images.clearImage,"Clear logs");
collapseContent = new GUIContent("",images.collapseImage,"Collapse logs");
Expand Down Expand Up @@ -944,7 +944,7 @@ void DrawReport()
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label( "Comming Soon", nonStyle , GUILayout.Height(size.y));
GUILayout.Label( "Coming Soon", nonStyle , GUILayout.Height(size.y));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
Expand Down Expand Up @@ -1171,7 +1171,7 @@ void DrawLogs()
//selectedIndex = Mathf.Clamp( selectedIndex , -1 , totalCount -1);
if( beforeHeight > 0 )
{
//fill invisible gap befor scroller to make proper scroller pos
//fill invisible gap before scroller to make proper scroller pos
GUILayout.BeginHorizontal( GUILayout.Height( beforeHeight ) );
GUILayout.Label("---");
GUILayout.EndHorizontal();
Expand Down Expand Up @@ -1814,8 +1814,8 @@ void Update()
fpsText = fps.ToString("0.000");
gcTotalMemory = (((float)System.GC.GetTotalMemory(false))/1024/1024) ;
//addSample();
if( string.IsNullOrEmpty( scenes[ Application.loadedLevel ] ))
scenes[ Application.loadedLevel ] = Application.loadedLevelName ;
if( string.IsNullOrEmpty( scenes[SceneManager.GetActiveScene().buildIndex] ))
scenes[ SceneManager.GetActiveScene().buildIndex ] = SceneManager.GetActiveScene().name ;

float elapsed = Time.realtimeSinceStartup - lastUpdate ;
fps = 1f / elapsed ;
Expand Down Expand Up @@ -1990,8 +1990,8 @@ void OnLevelWasLoaded()
if( clearOnNewSceneLoaded )
clear();

currentScene = Application.loadedLevelName ;
Debug.Log( "Scene " + Application.loadedLevelName + " is loaded");
currentScene = SceneManager.GetActiveScene().name ;
Debug.Log( "Scene " + SceneManager.GetActiveScene().name + " is loaded");
}

//save user config
Expand Down
11 changes: 6 additions & 5 deletions Reporter/Test/TestReporter.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using UnityEngine;
using System.Collections;
using System.Threading;
using UnityEngine.SceneManagement;

//this script used for test purpose ,it do by default 1000 logs + 1000 warnings + 1000 errors
//so you can check the functionality of in game logs
//just drop this scrip to any empty game object on first scene your game start at
public class TestReporter : MonoBehaviour {

public int logTestCount = 1000 ;
public int threadLogTestCount = 1000 ;
public int logTestCount = 100 ;
public int threadLogTestCount = 100 ;
public bool logEverySecond = true;
int currentLogTestCount;
Reporter reporter ;
Expand Down Expand Up @@ -101,13 +102,13 @@ void OnGUI()
GUI.Label (rect1, "Draw circle on screen to show logs" , style);
GUI.Label (rect2, "To use Reporter just create reporter from reporter menu at first scene your game start" , style);
if( GUI.Button( rect3 , "Load ReporterScene")){
Application.LoadLevel("ReporterScene");
SceneManager.LoadScene("ReporterScene");
}
if( GUI.Button( rect4 , "Load test1")){
Application.LoadLevel("test1");
SceneManager.LoadScene("test1");
}
if( GUI.Button( rect5 , "Load test2")){
Application.LoadLevel("test2");
SceneManager.LoadScene("test2");
}
GUI.Label (rect6, "fps : " + reporter.fps.ToString("0.0") , style);
}
Expand Down