├── .gitignore ├── Assets ├── UnityFileDebug.meta └── UnityFileDebug │ ├── Demo.meta │ ├── Demo │ ├── Test.unity │ ├── Test.unity.meta │ ├── Tester.cs │ └── Tester.cs.meta │ ├── Lib.meta │ ├── Lib │ ├── Editor.meta │ ├── Editor │ │ ├── PackageAsset.cs │ │ └── PackageAsset.cs.meta │ ├── Logger.meta │ ├── Logger │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── OpenInFileBrowser.cs │ │ │ ├── OpenInFileBrowser.cs.meta │ │ │ ├── UnityFileDebugEditor.cs │ │ │ └── UnityFileDebugEditor.cs.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ │ ├── Unity File Debug.prefab │ │ │ └── Unity File Debug.prefab.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── DebugWrapper.cs │ │ │ ├── DebugWrapper.cs.meta │ │ │ ├── UnityFileDebug.cs │ │ │ └── UnityFileDebug.cs.meta │ ├── Viewer.meta │ └── Viewer │ │ ├── UnityFileDebugViewer.html │ │ └── UnityFileDebugViewer.html.meta │ ├── README.txt │ └── README.txt.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── README.md └── UnityPackageManager └── manifest.json /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | .vs/ 21 | 22 | 23 | # Unity3D generated meta files 24 | *.pidb.meta 25 | 26 | # Unity3D Generated File On Crash Reports 27 | sysinfo.txt 28 | 29 | # Builds 30 | *.apk 31 | *.unitypackage -------------------------------------------------------------------------------- /Assets/UnityFileDebug.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f739d5468febb0949a05b82e5dd880ea 3 | folderAsset: yes 4 | timeCreated: 1457281226 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45757548ae7a84f4e838f1d80c82acd6 3 | folderAsset: yes 4 | timeCreated: 1457281263 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Demo/Test.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/Assets/UnityFileDebug/Demo/Test.unity -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Demo/Test.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae3872429dcabf7469af210b0ae54d16 3 | timeCreated: 1457210270 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Demo/Tester.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Tester : MonoBehaviour 4 | { 5 | private void Start() 6 | { 7 | throw new System.Exception("Even regular exceptions are logged"); 8 | } 9 | void Update() 10 | { 11 | Debug.Log("CPU 1 has done action a", DLogType.AI); 12 | Debug.Log("Assertion created with Debug.Log", DLogType.Assert); 13 | Debug.Log("Song1 has started playing", DLogType.Audio); 14 | Debug.Log("Asset1 has loaded", DLogType.Content); 15 | Debug.Log("Couldn't find save file", DLogType.Error); 16 | Debug.Log("Database couldn't load", DLogType.Exception); 17 | Debug.Log("Showing game over UI", DLogType.GUI); 18 | Debug.Log("Player 1 pressed A", DLogType.Input); 19 | Debug.Log("Nearby enemy count: 3", DLogType.Log); 20 | Debug.Log("Condition 42 has been met", DLogType.Logic); 21 | Debug.Log("Connected to Player 2 at 192.168.0.0", DLogType.Network); 22 | Debug.Log("Physics collision with Ball1", DLogType.Physics); 23 | Debug.Log("Running on mobile", DLogType.System); 24 | Debug.Log("This is a bad thing that you should be aware of", DLogType.Warning); 25 | Debug.Log("Warning future me, this log will perplex you as it has me. It will depend on XYZ to be fixed before ABC can be implemented which where this log is from depends on to function properly. Thanks, past me", DLogType.Log); 26 | 27 | Debug.Assert(true == false); 28 | Debug.Assert(true == false, "true equals false"); 29 | Debug.LogWarning("Warning"); 30 | Debug.LogError("Error"); 31 | Debug.LogAssertion("Conditionless assertion"); 32 | Debug.LogFormat("This is a green message!"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Demo/Tester.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abcfad27f753b3348adbbf1b32c6432d 3 | timeCreated: 1457210225 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c4a3c1df01284342adfa4a2a294f0cb 3 | folderAsset: yes 4 | timeCreated: 1457281283 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99d5a38efb7c85c4889afbc159503e03 3 | folderAsset: yes 4 | timeCreated: 1457282684 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Editor/PackageAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | 3 | public class PackageAsset 4 | { 5 | [MenuItem("SSS/Util/Package/Unity File Debug")] 6 | static void UpdatePackage() 7 | { 8 | AssetDatabase.ExportPackage("Assets/UnityFileDebug", "UnityFileDebug.unitypackage", ExportPackageOptions.Recurse); 9 | UnityEngine.Debug.Log("Saved package in root"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Editor/PackageAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de074b89219ce5b4092e3f319a4c5cf4 3 | timeCreated: 1457282559 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1468d2e39bc2d8c43ac904cf25f33738 3 | folderAsset: yes 4 | timeCreated: 1526789372 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa5181f3fc4644448b903cf12460ff90 3 | folderAsset: yes 4 | timeCreated: 1457272677 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Editor/OpenInFileBrowser.cs: -------------------------------------------------------------------------------- 1 | // http://wiki.unity3d.com/index.php/OpenInFileBrowser 2 | // CC BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/ 3 | 4 | public static class OpenInFileBrowser 5 | { 6 | public static bool IsInMacOS 7 | { 8 | get 9 | { 10 | return UnityEngine.SystemInfo.operatingSystem.IndexOf("Mac OS") != -1; 11 | } 12 | } 13 | 14 | public static bool IsInWinOS 15 | { 16 | get 17 | { 18 | return UnityEngine.SystemInfo.operatingSystem.IndexOf("Windows") != -1; 19 | } 20 | } 21 | 22 | public static void OpenInMac(string path) 23 | { 24 | bool openInsidesOfFolder = false; 25 | 26 | // try mac 27 | string macPath = path.Replace("\\", "/"); // mac finder doesn't like backward slashes 28 | 29 | if (System.IO.Directory.Exists(macPath)) // if path requested is a folder, automatically open insides of that folder 30 | { 31 | openInsidesOfFolder = true; 32 | } 33 | 34 | if (!macPath.StartsWith("\"")) 35 | { 36 | macPath = "\"" + macPath; 37 | } 38 | 39 | if (!macPath.EndsWith("\"")) 40 | { 41 | macPath = macPath + "\""; 42 | } 43 | 44 | string arguments = (openInsidesOfFolder ? "" : "-R ") + macPath; 45 | 46 | try 47 | { 48 | System.Diagnostics.Process.Start("open", arguments); 49 | } 50 | catch (System.ComponentModel.Win32Exception e) 51 | { 52 | // tried to open mac finder in windows 53 | // just silently skip error 54 | // we currently have no platform define for the current OS we are in, so we resort to this 55 | e.HelpLink = ""; // do anything with this variable to silence warning about not using it 56 | } 57 | } 58 | 59 | public static void OpenInWin(string path) 60 | { 61 | bool openInsidesOfFolder = false; 62 | 63 | // try windows 64 | string winPath = path.Replace("/", "\\"); // windows explorer doesn't like forward slashes 65 | 66 | if (System.IO.Directory.Exists(winPath)) // if path requested is a folder, automatically open insides of that folder 67 | { 68 | openInsidesOfFolder = true; 69 | } 70 | 71 | try 72 | { 73 | System.Diagnostics.Process.Start("explorer.exe", (openInsidesOfFolder ? "/root," : "/select,") + winPath); 74 | } 75 | catch (System.ComponentModel.Win32Exception e) 76 | { 77 | // tried to open win explorer in mac 78 | // just silently skip error 79 | // we currently have no platform define for the current OS we are in, so we resort to this 80 | e.HelpLink = ""; // do anything with this variable to silence warning about not using it 81 | } 82 | } 83 | 84 | public static void Open(string path) 85 | { 86 | if (IsInWinOS) 87 | { 88 | OpenInWin(path); 89 | } 90 | else if (IsInMacOS) 91 | { 92 | OpenInMac(path); 93 | } 94 | else // couldn't determine OS 95 | { 96 | OpenInWin(path); 97 | OpenInMac(path); 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Editor/OpenInFileBrowser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ce710f7adbfaad42b25c7b214ae78d5 3 | timeCreated: 1457277892 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Editor/UnityFileDebugEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace SSS 5 | { 6 | namespace UnityFileDebug 7 | { 8 | [CustomEditor(typeof(UnityFileDebug))] 9 | public class UnityFileDebugEditor : Editor 10 | { 11 | UnityFileDebug instance; 12 | 13 | SerializedProperty showAbsolute; 14 | SerializedProperty absolutePath; 15 | GUIContent absolutePathContent; 16 | 17 | SerializedProperty fileName; 18 | GUIContent fileNameContent; 19 | 20 | SerializedProperty filePath; 21 | SerializedProperty filePathFull; 22 | 23 | SerializedProperty fileType; 24 | GUIContent fileTypeContent; 25 | 26 | string copyPath; 27 | 28 | void OnEnable() 29 | { 30 | instance = (UnityFileDebug)target; 31 | 32 | absolutePathContent = new GUIContent 33 | { 34 | text = "Absolute Path", 35 | tooltip = "The absolute system path to store the outputted log files" 36 | }; 37 | 38 | fileNameContent = new GUIContent 39 | { 40 | text = "Export File Name", 41 | tooltip = "The filename (without extension) you would like to save logs as" 42 | }; 43 | 44 | fileTypeContent = new GUIContent 45 | { 46 | text = "Export File Type", 47 | tooltip = "Export file type" 48 | }; 49 | 50 | // Update references to serialized objects 51 | showAbsolute = serializedObject.FindProperty("useAbsolutePath"); 52 | absolutePath = serializedObject.FindProperty("absolutePath"); 53 | fileName = serializedObject.FindProperty("fileName"); 54 | filePath = serializedObject.FindProperty("filePath"); 55 | filePathFull = serializedObject.FindProperty("filePathFull"); 56 | fileType = serializedObject.FindProperty("fileType"); 57 | } 58 | 59 | public override void OnInspectorGUI() 60 | { 61 | serializedObject.Update(); 62 | instance.UpdateFilePath(); 63 | 64 | // Filename 65 | EditorGUILayout.PropertyField(fileName, fileNameContent); 66 | 67 | // File Type 68 | EditorGUILayout.PropertyField(fileType, fileTypeContent); 69 | 70 | // Output path type 71 | EditorGUILayout.PropertyField(showAbsolute); 72 | if (showAbsolute.boolValue) 73 | { 74 | EditorGUILayout.PropertyField(absolutePath, absolutePathContent); 75 | } 76 | else 77 | { 78 | EditorGUILayout.LabelField("using Application.persistentDataPath:\t" + Application.persistentDataPath); 79 | } 80 | 81 | // Open output path, copy html to output path 82 | EditorGUILayout.BeginHorizontal(); 83 | if (GUILayout.Button("Open Output Path")) 84 | { 85 | OpenInFileBrowser.Open(filePath.stringValue); 86 | } 87 | if (GUILayout.Button("Copy HTML to Output Path")) 88 | { 89 | copyPath = filePath.stringValue.Replace('\\', '/'); 90 | if (!copyPath.EndsWith("/")) { copyPath += "/"; } 91 | copyPath += "UnityFileDebugViewer.html"; 92 | FileUtil.ReplaceFile("Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html", copyPath); 93 | } 94 | EditorGUILayout.EndHorizontal(); 95 | 96 | // If running, show full output path and count 97 | if (Application.isPlaying) 98 | { 99 | EditorGUILayout.Separator(); 100 | EditorGUILayout.Separator(); 101 | EditorGUILayout.Separator(); 102 | EditorGUILayout.Separator(); 103 | EditorGUILayout.Separator(); 104 | 105 | EditorGUILayout.BeginHorizontal(); 106 | if (GUILayout.Button("Copy Output Filepath")) 107 | { 108 | EditorGUIUtility.systemCopyBuffer = filePathFull.stringValue; 109 | } 110 | EditorGUILayout.LabelField(filePathFull.stringValue); 111 | EditorGUILayout.EndHorizontal(); 112 | EditorGUILayout.LabelField("Logs added: " + instance.count); 113 | } 114 | 115 | EditorGUILayout.Separator(); 116 | EditorGUILayout.Separator(); 117 | EditorGUILayout.Separator(); 118 | EditorGUILayout.Separator(); 119 | EditorGUILayout.Separator(); 120 | 121 | // Tell the user what its about 122 | EditorGUILayout.HelpBox("Unity File Debug is made by Sacred Seed Studio and is MIT Licensed. Please feel free to use, modify, contribute, report bugs, and suggest features", MessageType.Info, true); 123 | EditorGUILayout.BeginHorizontal(); 124 | if (GUILayout.Button("Source")) 125 | { 126 | Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug"); 127 | } 128 | if (GUILayout.Button("Readme")) 129 | { 130 | Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug/blob/master/README.md"); 131 | } 132 | if (GUILayout.Button("Bugs / Feature Request")) 133 | { 134 | Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug/issues"); 135 | } 136 | EditorGUILayout.EndHorizontal(); 137 | 138 | serializedObject.ApplyModifiedProperties(); 139 | } 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Editor/UnityFileDebugEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17d0c02b66b2e7346a3edbcb37056d19 3 | timeCreated: 1457272729 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e6e34aaf650ecd4a89f9558f79bab7c 3 | folderAsset: yes 4 | timeCreated: 1457281256 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Prefabs/Unity File Debug.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/Assets/UnityFileDebug/Lib/Logger/Prefabs/Unity File Debug.prefab -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Prefabs/Unity File Debug.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 481d68ab1d1643c468af0c48a20a93c3 3 | timeCreated: 1457281659 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf325486130f8814b924765a006faf5a 3 | folderAsset: yes 4 | timeCreated: 1526924871 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Scripts/DebugWrapper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public enum DLogType 4 | { 5 | Assert, 6 | Error, 7 | Exception, 8 | Warning, 9 | System, 10 | Log, 11 | AI, 12 | Audio, 13 | Content, 14 | Logic, 15 | GUI, 16 | Input, 17 | Network, 18 | Physics 19 | } 20 | 21 | public static class Debug 22 | { 23 | #region Assert 24 | public static void Assert(bool condition) { UnityEngine.Debug.Assert(condition); } 25 | public static void Assert(bool condition, Object context) { UnityEngine.Debug.Assert(condition, context); } 26 | public static void Assert(bool condition, object message) { UnityEngine.Debug.Assert(condition, message); } 27 | public static void Assert(bool condition, object message, Object context) { UnityEngine.Debug.Assert(condition, message, context); } 28 | public static void AssertFormat(bool condition, string format, params object[] args) { UnityEngine.Debug.AssertFormat(condition, format, args); } 29 | public static void AssertFormat(bool condition, Object context, string format, params object[] args) { UnityEngine.Debug.AssertFormat(condition, context, format, args); } 30 | public static void LogAssertion(object message) { UnityEngine.Debug.LogAssertion(message); } 31 | public static void LogAssertion(object message, Object context) { UnityEngine.Debug.LogAssertion(message, context); } 32 | public static void LogAssertionFormat(string format, params object[] args) { UnityEngine.Debug.LogAssertionFormat(format, args); } 33 | public static void LogAssertionFormat(Object context, string format, params object[] args) { UnityEngine.Debug.LogAssertionFormat(context, format, args); } 34 | #endregion 35 | 36 | #region Helper 37 | public static void Break() { UnityEngine.Debug.Break(); } 38 | public static void ClearDeveloperConsole() { UnityEngine.Debug.ClearDeveloperConsole(); } 39 | public static bool isDebugBuild { get { return UnityEngine.Debug.isDebugBuild; } } 40 | #endregion 41 | 42 | #region Draw 43 | public static void DrawRay(Vector3 start, Vector3 dir) { UnityEngine.Debug.DrawRay(start, dir); } 44 | public static void DrawRay(Vector3 start, Vector3 dir, Color color) { UnityEngine.Debug.DrawRay(start, dir, color); } 45 | public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration) { UnityEngine.Debug.DrawRay(start, dir, color, duration); } 46 | public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration, bool depthTest) { UnityEngine.Debug.DrawRay(start, dir, color, duration, depthTest); } 47 | public static void DrawLine(Vector3 start, Vector3 end) { UnityEngine.Debug.DrawLine(start, end); } 48 | public static void DrawLine(Vector3 start, Vector3 end, Color color) { UnityEngine.Debug.DrawLine(start, end, color); } 49 | public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration) { UnityEngine.Debug.DrawLine(start, end, color, duration); } 50 | public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration, bool depthTest) { UnityEngine.Debug.DrawLine(start, end, color, duration, depthTest); } 51 | #endregion 52 | 53 | #region Log 54 | public static void Log(object message, DLogType type = DLogType.Log) { UnityEngine.Debug.Log("[" + type + "] " + message); } 55 | public static void Log(object message, Object context, DLogType type = DLogType.Log) { UnityEngine.Debug.Log("[" + type + "] " + message, context); } 56 | public static void LogFormat(string format, DLogType type = DLogType.Log, params object[] args) { UnityEngine.Debug.LogFormat("[" + type + "] " + format, args); } 57 | public static void LogFormat(Object context, string format, DLogType type = DLogType.Log, params object[] args) { UnityEngine.Debug.LogFormat(context, "[" + type + "] " + format, args); } 58 | #endregion 59 | 60 | #region Error 61 | public static void LogError(object message, DLogType type = DLogType.Error) { UnityEngine.Debug.LogError("[" + type + "] " + message); } 62 | public static void LogError(object message, Object context, DLogType type = DLogType.Error) { UnityEngine.Debug.Log("[" + type + "] " + message, context); } 63 | public static void LogErrorFormat(string format, params object[] args) { UnityEngine.Debug.LogErrorFormat(format, args); } 64 | public static void LogErrorFormat(Object context, string format, params object[] args) { UnityEngine.Debug.LogErrorFormat(context, format, args); } 65 | #endregion 66 | 67 | #region Exception 68 | public static void LogException(System.Exception exception) { UnityEngine.Debug.LogException(exception); } 69 | public static void LogException(System.Exception exception, Object context) { UnityEngine.Debug.LogException(exception, context); } 70 | #endregion 71 | 72 | #region Warning 73 | public static void LogWarning(object message, DLogType type = DLogType.Warning) { UnityEngine.Debug.LogWarning("[" + type + "] " + message); } 74 | public static void LogWarning(object message, Object context, DLogType type = DLogType.Warning) { UnityEngine.Debug.LogWarning("[" + type + "] " + message, context); } 75 | #endregion 76 | } 77 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Scripts/DebugWrapper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7938c93e937d3e45bb5732c388271a9 3 | timeCreated: 1526784860 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Scripts/UnityFileDebug.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace SSS 4 | { 5 | namespace UnityFileDebug 6 | { 7 | // short keynames are used to make json output small 8 | [System.Serializable] 9 | public class LogOutput 10 | { 11 | public string t; //type 12 | public string tm; //time 13 | public string l; //log 14 | public string s; //stack 15 | } 16 | 17 | public enum FileType 18 | { 19 | CSV, 20 | JSON, 21 | TSV, 22 | TXT 23 | } 24 | 25 | [ExecuteInEditMode] 26 | public class UnityFileDebug : MonoBehaviour 27 | { 28 | public bool useAbsolutePath = false; 29 | public string fileName = "MyGame"; 30 | public FileType fileType = FileType.CSV; 31 | 32 | public string absolutePath = "c:\\"; 33 | 34 | public string filePath; 35 | public string filePathFull; 36 | public int count = 0; 37 | 38 | System.IO.StreamWriter fileWriter; 39 | 40 | string FileExtensionFromType(FileType type) 41 | { 42 | switch (type) 43 | { 44 | case FileType.JSON: return ".json"; 45 | case FileType.CSV: return ".csv"; 46 | case FileType.TSV: return ".tsv"; 47 | case FileType.TXT: 48 | default: return ".txt"; 49 | } 50 | } 51 | 52 | void OnEnable() 53 | { 54 | UpdateFilePath(); 55 | if (Application.isPlaying) 56 | { 57 | count = 0; 58 | fileWriter = new System.IO.StreamWriter(filePathFull, false); 59 | fileWriter.AutoFlush = true; 60 | switch (fileType) 61 | { 62 | case FileType.CSV: 63 | fileWriter.WriteLine("type,time,log,stack"); 64 | break; 65 | case FileType.JSON: 66 | fileWriter.WriteLine("["); 67 | break; 68 | case FileType.TSV: 69 | fileWriter.WriteLine("type\ttime\tlog\tstack"); 70 | break; 71 | } 72 | Application.logMessageReceived += HandleLog; 73 | } 74 | } 75 | 76 | public void UpdateFilePath() 77 | { 78 | filePath = useAbsolutePath ? absolutePath : Application.persistentDataPath; 79 | filePathFull = System.IO.Path.Combine(filePath, fileName + "." + System.DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss") + FileExtensionFromType(fileType)); 80 | } 81 | 82 | void OnDisable() 83 | { 84 | if (Application.isPlaying) 85 | { 86 | Application.logMessageReceived -= HandleLog; 87 | 88 | switch (fileType) 89 | { 90 | case FileType.JSON: 91 | fileWriter.WriteLine("\n]"); 92 | break; 93 | case FileType.CSV: 94 | case FileType.TSV: 95 | default: 96 | break; 97 | } 98 | fileWriter.Close(); 99 | } 100 | } 101 | 102 | void HandleLog(string logString, string stackTrace, LogType type) 103 | { 104 | LogOutput output = new LogOutput(); 105 | if (type == LogType.Assert) 106 | { 107 | output.t = "Assert"; 108 | output.l = logString; 109 | } 110 | else if (type == LogType.Exception) 111 | { 112 | output.t = "Exception"; 113 | output.l = logString; 114 | } 115 | else 116 | { 117 | int end = logString.IndexOf("]"); 118 | if (end > 1) 119 | { 120 | output.t = logString.Substring(1, end - 1); 121 | output.l = logString.Substring(end + 2); 122 | } 123 | else 124 | { 125 | output.t = type.ToString(); 126 | output.l = logString; 127 | } 128 | } 129 | 130 | output.s = stackTrace; 131 | output.tm = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); 132 | 133 | switch (fileType) 134 | { 135 | case FileType.CSV: 136 | fileWriter.WriteLine(output.t + "," + output.tm + "," + output.l.Replace(",", " ").Replace("\n", "") + "," + output.s.Replace(",", " ").Replace("\n", "")); 137 | break; 138 | case FileType.JSON: 139 | fileWriter.Write((count == 0 ? "" : ",\n") + JsonUtility.ToJson(output)); 140 | break; 141 | case FileType.TSV: 142 | fileWriter.WriteLine(output.t + "\t" + output.tm + "\t" + output.l.Replace("\t", " ").Replace("\n", "") + "\t" + output.s.Replace("\t", " ").Replace("\n", "")); 143 | break; 144 | case FileType.TXT: 145 | fileWriter.WriteLine("Type: " + output.t); 146 | fileWriter.WriteLine("Time: " + output.tm); 147 | fileWriter.WriteLine("Log: " + output.l); 148 | fileWriter.WriteLine("Stack: " + output.s); 149 | break; 150 | } 151 | 152 | count++; 153 | } 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Logger/Scripts/UnityFileDebug.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 090d1a01815d66148a1da034355aed0b 3 | timeCreated: 1457210015 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Viewer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3d10224e989d554cb30ba2cb56f0546 3 | folderAsset: yes 4 | timeCreated: 1526789385 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Unity File Debug Viewer 10 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 |
311 |
312 | 313 |
314 |
315 | 316 | Started: 317 | Ended: 318 |
319 |
320 | 321 |
    322 |
  • 323 |
324 |
325 | 328 | 336 |
337 | 338 |
339 |
340 |

Welcome to Unity File Debug Viewer

341 |

To start, load an exported .csv, .tsv, .json in the top left

342 |

Note: thousands of logs can result in this page taking seconds to compute

343 |
344 |
345 | 346 | 729 | 730 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 646f265711031ed47bc4cfd3cd374bff 3 | timeCreated: 1457229943 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/README.txt: -------------------------------------------------------------------------------- 1 | ******************************** 2 | ********** HOW TO USE ********** 3 | ******************************** 4 | 5 | 1. Move the prefab Unity File Debug into your scene 6 | 2. Setup the file name, type, and path settings in the inspector. Do not include an extension on the name. 7 | 3. Copy the HTML to your output path via inspector button 8 | 4. Use Debug.Log as normal, or for more advanced usage see Tester script in Demo folder 9 | 5. Open the UnityFileDebugViewer.html file from your log folder, browse for a log file in the top left 10 | 11 | If you don't specify an absolute filepath, Application.persistentDataPath will be used. 12 | 13 | HTML viewer is designed for modern browsers (chrome/firefox) 14 | 15 | See the Readme on GitHub for more information 16 | https://github.com/Sacred-Seed-Studio/Unity-File-Debug/blob/master/README.md 17 | 18 | ********************************* 19 | 20 | Unity File Debugger 21 | MIT Licensed 22 | 23 | Source: https://github.com/Sacred-Seed-Studio/Unity-File-Debug 24 | Bugs / Feature Requests: https://github.com/Sacred-Seed-Studio/Unity-File-Debug/issues 25 | -------------------------------------------------------------------------------- /Assets/UnityFileDebug/README.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f142232f242d65f469ce7968bd971a23 3 | timeCreated: 1457282080 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Sacred Seed Studio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.4.3f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sacred-Seed-Studio/Unity-File-Debug/0e390c3b2393d5c47d9bddc03f37916098776289/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-File-Debug 2 | ![Unity Version][unity-badge]  3 | [![Platform][platform-badge]][repo]  4 | [![GitHub license][license-badge]][license]  5 | [![GitHub release][version-badge]][releases]  6 | [![GitHub issues][issues-badge]][issues]  7 | [![Pull Requests][pr-badge]][pulls]  8 | 9 | Enhanced debug logging for Unity, with file export and HTML viewer. 10 | - [Read the blog post](http://www.sacredseedstudio.com/blog/2016/06/05/Output-the-Unity-console-to-file) 11 | - [See the demo](http://www.sacredseedstudio.com/Unity-File-Debug/) 12 | - [Unity Asset Store](https://assetstore.unity.com/packages/tools/utilities/unity-file-debug-72250) 13 | 14 | ## Why 15 | - Output Unity debug info to log files (csv, tsv, json, txt) 16 | - A nice web interface to view the log files (csv, tsv, json) 17 | - HTML5 (single file) 18 | - No external dependencies 19 | - Searchable via message, stacktrace, timestamp, logtype 20 | - Filterable by logtype 21 | - Be able to drop it into existing projects 22 | 23 | ## How to use 24 | 1. Import the [latest release's package](https://github.com/Sacred-Seed-Studio/Unity-File-Debug/releases) into your project 25 | 2. Move the prefab `Unity File Debug` into your scene 26 | 3. Setup the filepath and settings in the inspector 27 | 4. Copy the HTML to your output path via inspector button 28 | 5. Use `Debug.Log` as normal, or for more advanced usage see [Tester](/Assets/UnityFileDebug/Demo/Tester.cs) script in `Demo` folder 29 | 6. Open the `UnityFileDebugViewer.html` file from your log folder, browse for a log file from the top left 30 | 31 | If you don't specify an absolute filepath, Application.persistentDataPath will be used. 32 | 33 | HTML viewer is designed for modern browsers (chrome/firefox) 34 | 35 | ## Developing 36 | - Fork/clone this repository 37 | - Open in Unity 38 | - Hack away 39 | 40 | ## How to Customize 41 | ### Custom log types 42 | 1. Change DLogType enumeration in [DebugWrapper.cs](/Assets/UnityFileDebug/Lib/Logger/Scripts/DebugWrapper.cs) 43 | 2. Update `topLogTypes` and `nestedLogTypes` arrays in [UnityFileDebugViewer.html](/Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html) 44 | 3. Update `LogTypeColors` css in [UnityFileDebugViewer.html](/Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html) 45 | 4. Update svg icons in [UnityFileDebugViewer.html](/Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.html) 46 | 47 | ### No nesting in viewer 48 | 1. Move all elements from `nestedLogTypes` array to `topLogTypes` in [UnityFileDebugViewer.html](/Assets/UnityFileDebug/Lib/Viewer/UnityFileDebugViewer.cs) 49 | 50 | ### Using other log sources 51 | The viewer supports a few different file formats 52 | 53 | ##### JSON format: 54 | ```js 55 | { 56 | t: '', // type 57 | tm: '', // time 58 | l: '', // log message 59 | s: '', // log stack trace 60 | } 61 | ``` 62 | 63 | ##### CSV header: 64 | `type,time,log,stack` 65 | 66 | ##### TSV header: 67 | `type time log stack` 68 | 69 | --- 70 | 71 | ## Release 72 | In the Unity Editor, click the menu option `SSS/Util/Package/Unity File Debug`. The `UnityFileDebug.unitypackage` will be in the root of this project. 73 | 74 | 77 | [version-badge]:https://img.shields.io/github/release/Sacred-Seed-Studio/Unity-File-Debug.svg 78 | [platform-badge]:https://img.shields.io/badge/platform-All-blue.svg 79 | [issues-badge]:https://img.shields.io/github/issues/Sacred-Seed-Studio/Unity-File-Debug.svg 80 | [license-badge]:https://img.shields.io/github/license/Sacred-Seed-Studio/Unity-File-Debug.svg 81 | [unity-badge]:https://img.shields.io/badge/Unity-5.4+-blue.svg 82 | [pr-badge]:https://img.shields.io/github/issues-pr/Sacred-Seed-Studio/Unity-File-Debug.svg 83 | 84 | 87 | [releases]:https://github.com/Sacred-Seed-Studio/Unity-File-Debug/releases 88 | [repo]:https://github.com/Sacred-Seed-Studio/Unity-File-Debug 89 | [issues]:https://github.com/Sacred-Seed-Studio/Unity-File-Debug/issues 90 | [license]:https://github.com/Sacred-Seed-Studio/Unity-File-Debug/blob/master/LICENSE 91 | [pulls]:https://github.com/Sacred-Seed-Studio/Unity-File-Debug/pulls 92 | -------------------------------------------------------------------------------- /UnityPackageManager/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | --------------------------------------------------------------------------------