Saving streamed Data from Unity in a csv File

Hi, I have to record the coordinate-data (vector of x,y,z) of an eye-tracking System and save it, for later evaluation. The whole eye-tracking System is integrated inside a Head-mounted-Display and the software runs over Unity.
After some research, I figured out that saving the Data in a CSV file would probably the easiest way. This is what I got so far:

void Start()
    {
        smiInstance = SMI.SMIEyeTrackingUnity.Instance;
        if (File.Exists(FilePath))
            File.Delete(FilePath);
        filePath = filePath + DateTime.Now.ToString("yyyy-mm-dd-hh-mm-ss") + ".txt";
        update();
    }

    void update()
    {
        
        Vector3 leftGazeDirection = smiInstance.smi_GetLeftGazeDirection();
        Vector3 rightGazeDirection = smiInstance.smi_GetRightGazeDirection();




        float[] output = new float[]{
leftGazeDirection.x, 
leftGazeDirection.y, 
leftGazeDirection.z, 
rightGazeDirection.x,
rightGazeDirection.y, 
rightGazeDirection.z};
  

        int length = output.Length;
     
        StringBuilder sb = new StringBuilder();
        for (int index = 0; index < length; index++)
        sb.AppendLine(string.Join(delimiter, output[index]));

        if (!File.Exists(filePath))
            File.WriteAllText(filePath, sb.ToString());
        else
            File.AppendAllText(filePath, sb.ToString());    }
}

The Result of this is a CSV file with the Vector of the latest Position of the Gazedirection. What I need would be a Record of all the Gazedirections that were made in one Session. Is it possible to get something like this?
Can I somehow modify my Code to achieve this or should I try something completely different?
Since I’m very newbie to unity and programming in general I might just have a lack of vocabulary and don’t know what to search for to solve my problem…
I would be very thankful if somebody could help me. :slight_smile:

i think your problem is easier than all of that, just change

update()

to

Update()

and there is not need for you to call it from the start since unity will call it per frame.
right now you are only calling it once, and you are deleting the file in the start just before that.