Skip to content

Commit ae488f3

Browse files
committed
Close #1 Allow time flag, Allow building
1 parent 6e6a44e commit ae488f3

6 files changed

Lines changed: 23 additions & 16 deletions

File tree

8 Bytes
Binary file not shown.

Assets/UnityFileDebug/Editor/UnityFileDebugEditor.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class UnityFileDebugEditor : Editor
1616
SerializedProperty filePath;
1717
SerializedProperty filePathFull;
1818

19+
SerializedProperty logTime;
20+
GUIContent logTimeContent;
21+
1922
string copyPath;
2023

2124
void OnEnable()
@@ -30,19 +33,27 @@ void OnEnable()
3033
fileNameContent.text = "File Name";
3134
fileNameContent.tooltip = "The filename (without extension) you would like to save logs as";
3235

36+
logTimeContent = new GUIContent();
37+
logTimeContent.text = "Log Time";
38+
logTimeContent.tooltip = "Log the time out with each event?";
39+
3340
// Update references to serialized objects
3441
showAbsolute = serializedObject.FindProperty("useAbsolutePath");
3542
absolutePath = serializedObject.FindProperty("absolutePath");
3643
fileName = serializedObject.FindProperty("fileName");
3744
filePath = serializedObject.FindProperty("filePath");
3845
filePathFull = serializedObject.FindProperty("filePathFull");
46+
logTime = serializedObject.FindProperty("logTime");
3947
}
4048

4149
public override void OnInspectorGUI()
4250
{
4351
serializedObject.Update();
4452
instance.UpdateFilePath();
4553

54+
// Log Time
55+
EditorGUILayout.PropertyField(logTime, logTimeContent);
56+
4657
// Filename
4758
EditorGUILayout.PropertyField(fileName, fileNameContent);
4859

Assets/UnityFileDebug/Lib/OpenInFileBrowser.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// http://wiki.unity3d.com/index.php/OpenInFileBrowser
22
// CC BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/
3+
34
public static class OpenInFileBrowser
45
{
56
public static bool IsInMacOS
@@ -18,12 +19,6 @@ public static bool IsInWinOS
1819
}
1920
}
2021

21-
[UnityEditor.MenuItem("Window/Test OpenInFileBrowser")]
22-
public static void Test()
23-
{
24-
Open(UnityEngine.Application.dataPath);
25-
}
26-
2722
public static void OpenInMac(string path)
2823
{
2924
bool openInsidesOfFolder = false;

Assets/UnityFileDebug/Lib/UnityFileDebug.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class LogJSON
1212
[ExecuteInEditMode]
1313
public class UnityFileDebug : MonoBehaviour
1414
{
15-
public bool showTime = false;
15+
public bool logTime = true;
1616
public bool useAbsolutePath = false;
1717
public string fileName = "MyGame";
1818

@@ -76,16 +76,17 @@ void HandleLog(string logString, string stackTrace, LogType type)
7676
}
7777

7878
j.s = stackTrace;
79-
j.tm = System.DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss");
79+
if (logTime){ j.tm = System.DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss"); }
8080

81-
if (count == 0)
82-
{
83-
fileWriter.Write(JsonUtility.ToJson(j));
84-
}
85-
else
86-
{
87-
fileWriter.Write(",\n" + JsonUtility.ToJson(j));
88-
}
81+
fileWriter.Write((count == 0 ? "" : ",\n") + JsonUtility.ToJson(j));
82+
//if (count == 0)
83+
//{
84+
// fileWriter.Write(JsonUtility.ToJson(j));
85+
//}
86+
//else
87+
//{
88+
// fileWriter.Write(",\n" + JsonUtility.ToJson(j));
89+
//}
8990
count++;
9091
}
9192
}
-96 Bytes
Binary file not shown.
48 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)