void PrintDatas(string dataType) { var parent = Directory.GetParent(Application.dataPath); var directoryPath = parent.FullName + "/ProfilerData"; if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } var outputPath = string.Format("{0}/ProfilerDetailed{1:yyyy_MM_dd_HH_mm_ss}.txt", directoryPath, DateTime.Now); File.Create(outputPath).Dispose(); using (var writer = new StreamWriter(outputPath)) { switch (dataType) { case "CPU": ProfilerWindow.SwitchWindow(ProfilerArea.CPU); ProfilerWindow.WriteCPU(writer, ProfilerWindow.GetCPUDetail(writer)); break; case "GPU": ProfilerWindow.SwitchWindow(ProfilerArea.GPU); ProfilerWindow.WriteGPU(writer, ProfilerWindow.GetGPUDetail(writer)); break; } writer.Flush(); writer.Close(); } Process.Start(outputPath); }