Created
October 11, 2015 16:30
-
-
Save Naphier/efabcd1cc27948d818a6 to your computer and use it in GitHub Desktop.
Simple debugging to file. Useful for creating CSV files where you want to look at variable changes over each frame.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using UnityEngine; | |
namespace NG | |
{ | |
public class DebugToFile | |
{ | |
public static List<string> dOut = new List<string>(); | |
public static void WriteToLog(string fileName) | |
{ | |
using (StreamWriter sw = new StreamWriter(Application.dataPath + "/" + fileName)) | |
{ | |
foreach (string s in dOut) | |
{ | |
sw.WriteLine(s); | |
} | |
} | |
} | |
public static void WriteToLog() | |
{ | |
WriteToLog("output.csv"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment