79802227

Date: 2025-10-27 20:34:11
Score: 2
Natty:
Report link

Thank you both so much @derHugo and @Gerry Schmitz! Combining your suggestions (saving at periodic intervals and not only exporting at OnApplicationQuit allowed me to get the CSVs saved as intended!

In case anyone else has a similar issue in the future, I added in the following lines to my code to get it to work as intended:

Before void Start():

public float saveIntervalInSeconds = 15.0f; // logs the data every 15 seconds; adjustable in Inspector

At the end of void Start() (after dataLines.Add):

StartCoroutine(SaveRoutine());

Between voidRecordData() and void OnApplicationQuit():

private System.Collections.IEnumerator SaveRoutine()
{
    while (true)
    {
        yield return new WaitForSeconds(saveIntervalInSeconds);
        SaveData();
    }
}

I kept the OnApplicationQuit export point just as a final export point, to try to cover any data that may not have been exported in the smaller intervals.

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @derHugo
  • User mentioned (0): @Gerry
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: sam