I’m sending a standalone version of my game to other people and let them test it.
Since it’s a Development Build it will automaticly create a OutputLog file.
That helps a lot for finding problems but I would like to make a second log file that captures all inputs the player presses.
I want it in another log file to make it easier to search.
Any idea how I could do that?
1 Like
I should have waited before posting this
It’s actualy very simple and I even used it several times before.
Here is how you can do it if someone wants to know.
using System.IO;
string directory = Directory.GetCurrentDirectory().ToString();
string logName = @"\gameLog.txt";
string path;
void Start () {
path = directory + logName;
}
public void WriteToLog(string input)
{
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(input);
}
}
else
{
using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine(input);
}
}
}
If there is something wrong with this or I can do the same without using System.IO please tell me.
4 Likes
Fattie
August 29, 2020, 3:39pm
3
Fortunately it is now very easy to write the actual normal log to anywhere you want:
In Unity 2017.2, in Windows the log file is now located in C:\Users\username\AppData\Local\CompanyName\ProductName\output_log.txt when it used to be in the Product_Data folder. And that makes sense for release builds, but is there an option to...
Reading time: 1 mins 🕑
Likes: 9 ❤
then just use Debug.Log etc as normal
@Khazmadu
1 Like