Store Data

Forum for development eye controlled Unity 3D applications

Store Data

Postby stephane.bouilland » 11 Apr 2016, 13:25

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
stephane.bouilland
 
Posts: 4
Joined: 28 Oct 2015, 10:43

Re: Store Data

Postby Martin » 11 Apr 2016, 14:13

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();
    }
}

Martin
 
Posts: 567
Joined: 29 Oct 2013, 15:20

Re: Store Data

Postby stephane.bouilland » 26 May 2016, 08:50

Thanks it works very well, it was all I needed ;)
stephane.bouilland
 
Posts: 4
Joined: 28 Oct 2015, 10:43


Return to Unity



cron