> For the complete documentation index, see [llms.txt](https://llando.gitbook.io/ttsystem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://llando.gitbook.io/ttsystem/guides/accessing-time-trial-data.md).

# Accessing Time Trial Data

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.&#x20;

### Where To Find Time Trial Data:

* To access time trial data, declare a reference to the [LapTimeTrackingObject ](/ttsystem/components-prefabs/laptimetrackingobject.md)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 ](/ttsystem/components-prefabs/laptimetrackingobject.md)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 ](/ttsystem/components-prefabs/laptimetrackingobject.md)using your own script, a good option is to store a list of relevant [LapTimeTrackingObjects](/ttsystem/components-prefabs/laptimetrackingobject.md) in that script. This could be a list of your players, AI opponents etc.
  * The various time trial data stored in the [LapTimeTrackingObject ](/ttsystem/components-prefabs/laptimetrackingobject.md)that can be accessed is seen below.

in [LapTimeTrackingObject.cs](/ttsystem/components-prefabs/laptimetrackingobject.md):

```csharp
public Sector[] sectors { get; set; } // Used to access individual sector data

private double bestLapTime = double.MaxValue; // Raw time
public double BestLapTime => bestLapTime; // Raw time, as read-only public property

public string BestLapTimeConverted { get; private set; } = "-"; // Formatted time

private double currentLapTime = 0; // Raw time
public double CurrentLapTime => currentLapTime // Raw time, as read-only public property

public string CurrentLapTimeConverted { get; private set; } // Formatted time

private bool isLapInProgress = false;
```

* **sectors** - see [Sector ](/ttsystem/internal-classes/sector.md)for details
* **bestLapTime** - Raw time value of the best lap time for that [LapTimeTrackingObject](/ttsystem/components-prefabs/laptimetrackingobject.md)
* **BestLapTimeConverted** - Formatted best lap time for that [LapTimeTrackingObject](/ttsystem/components-prefabs/laptimetrackingobject.md)
* **currentLapTime** - Raw time value of the current lap time for that [LapTimeTrackingObject](/ttsystem/components-prefabs/laptimetrackingobject.md)
* **CurrentLapTimeConverted** - Formatted current lap time for that [LapTimeTrackingObject](/ttsystem/components-prefabs/laptimetrackingobject.md)
* **isLapInProgress** - Check whether that [LapTimeTrackingObject ](/ttsystem/components-prefabs/laptimetrackingobject.md)is currently in a lap

### What Next?

#### [How do I add time trial UI to my project?](/ttsystem/guides/adding-time-trial-ui.md)

#### [How do I make time trial data save across game sessions?](/ttsystem/guides/adding-time-trial-saves.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://llando.gitbook.io/ttsystem/guides/accessing-time-trial-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
