Hello Guys,
I am making a car racing simulator and I have a problem now!
I want to record the time from the Play of the scene until the Stop and then in between when I apply my brake I want to record the instance(Time Frame) of the moment (Min:Sec: Microsec) when I pressed the brake and I want to store the data onto an external excel file.
Would someone be able to help me out please.!!
Heyya!
This should be quite simple, the .cvs file works pretty well with excel and it’s very simple to create.
A .cvs is a comma separated values file.
Basically just a text file with a comma (or a ; if you want, just setup you excel later) separator.
So, you could create a string with the following info:
event, time
start, 0
break, 0.1
break, 15.8
break, 85.2
end, 105
(use \n when defining the string to break the line)
Later, you can, for instance, use the code:
System.IO.File.WriteAllText(Application.persistentDataPath + "/ExcelFile.csv", myString);
To save your string (called myString) to the file (The first argument is the path, print that out if you don’t know where it will be).
1 Like