private void OnGUI() { List <string> names = new List <string>(InternalDataManager.DataDictionary.Keys); selectItem = EditorDrawGUIUtil.DrawPopup("内部数据:", selectItem, names); if (string.IsNullOrEmpty(selectItem)) { return; } object obj = InternalDataManager.DataDictionary[selectItem]; pos0 = GUILayout.BeginScrollView(pos0); obj = EditorDrawGUIUtil.DrawBaseValue(obj.GetHashCode().ToString(), obj, EditorUIOpenState.OpenFirstFold); GUILayout.EndScrollView(); if (GUILayout.Button("Clear")) { InternalDataManager.Clear(); } if (GUILayout.Button("Log")) { ULog.Log("Test log"); } }
private static void Init() { dirPath = Application.persistentDataPath + LogDirName; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } IsOpenLog = PlayerPrefs.GetInt(PlayerPrefsKey_OpenLog, 1) == 1 ? true : false; IsWriteLogToFile = PlayerPrefs.GetInt(PlayerPrefsKey_WriteToFile, 1) == 1 ? true : false; //在这里做一个Log的监听 //转载的原文中是用Application.RegisterLogCallback(HandleLog);但是这个方法在unity5.0版本已经废弃不用了 Application.logMessageReceived += HandleLog; InternalDataManager.PutData("LogData", ULog.logMessages); }