Page 1 of 1

Store Data

PostPosted: 11 Apr 2016, 13:25
by stephane.bouilland
Hello, I would like to use the EyeTribe in Unity and I was wondering if it's possible to store the data of the the gaze in file. For example in the game aircraft I would like to know if it's possible to store the data of the gaze position in a tsv, txt or csv format. And if it's possible how can I do this ?

Thanks

Re: Store Data

PostPosted: 11 Apr 2016, 14:13
by Martin
Should be possible with the builtin .Net StreamWriter class.

Something along the lines of:

Code: Select all

string saveFilePath = "gazedata.txt";
StreamWriter logWriter;

public void OnGazeUpdate(GazeData gazeData)
{
     if(logWriter == null)
     {
         logWriter = new StreamWriter(File.Open(saveFilePath, FileMode.Create, FileAccess.Write, FileShare.Read));
     }

     logWriter.WriteLine(gazeData.SmoothedCoordinates.X + ":" + gazeData.SmoothedCoordinates.Y);
     logWriter.Flush();
}

public void StopAndSave()
{
    if(logWriter != null)
    {
        logWriter.Flush();
        logWriter.Close();
    }
}


Re: Store Data

PostPosted: 26 May 2016, 08:50
by stephane.bouilland
Thanks it works very well, it was all I needed ;)