Standalone Build Log files.

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 :face_with_spiral_eyes:

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

Fortunately it is now very easy to write the actual normal log to anywhere you want:

then just use Debug.Log etc as normal

@Khazmadu

1 Like