📪Accessing Time Trial Data
Guide
Once you have time trial logic setup, there are an infinite number of different ways you may want to make use of it. For example: displaying time trial data in custom UI, saving to a leaderboard backend etc.
To do this, you need to hook into the data that Complete Time Trial System provides to use it for your own use cases.
Where To Find Time Trial Data:
To access time trial data, declare a reference to the LapTimeTrackingObject in your script and assign it accordingly. You can then access time trial data from this reference directly.
The majority of time trial data is held in the LapTimeTrackingObject component. This is because it allows time trial data to be unique to the object, allowing many objects to all keep track of their own time trial data simultaneously.
If you want to access data in all LapTimeTrackingObjects using your own script, a good option is to store a list of relevant LapTimeTrackingObjects in that script. This could be a list of your players, AI opponents etc.
If you need to access raw unformatted time trial data, set the associated fields to public instead.
The various time trial data stored in the LapTimeTrackingObject that can be accessed is seen below.
sectors - see Sector for details
bestLapTime - Raw time value of the best lap time for that LapTimeTrackingObject
BestLapTimeConverted - Formatted best lap time for that LapTimeTrackingObject
currentLapTime - Raw time value of the current lap time for that LapTimeTrackingObject
CurrentLapTimeConverted - Formatted current lap time for that LapTimeTrackingObject
isLapInProgress - Check whether that LapTimeTrackingObject is currently in a lap
What Next?
Last updated