diff --git a/README.md b/README.md index bd8f53e..e9ff3cc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Reporter/Reporter.cs b/Reporter/Reporter.cs index 71ccbdb..92cb9c4 100644 --- a/Reporter/Reporter.cs +++ b/Reporter/Reporter.cs @@ -5,7 +5,7 @@ //using System; using System.Collections; using System.Collections.Generic; - +using UnityEngine.SceneManagement; [System.Serializable] @@ -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 ; @@ -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 ; @@ -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; @@ -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 ); @@ -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)); @@ -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"); @@ -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(); @@ -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(); @@ -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 ; @@ -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 diff --git a/Reporter/Test/TestReporter.cs b/Reporter/Test/TestReporter.cs index cf7fc87..33fbbe0 100644 --- a/Reporter/Test/TestReporter.cs +++ b/Reporter/Test/TestReporter.cs @@ -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 ; @@ -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); }