llando
  • Overview
    • 💡Introduction
    • ✨Feature List
  • Guides
    • 📪Quick Setup
    • 📪Manual Setup
    • 📪Utilizing Time Trial Data Effectively
    • 📪Adding Time Trial UI
    • 📪Adding Time Trial Saves
    • 📪Accessing Time Trial Data
    • 📪Adding New Tracks
  • Components/Prefabs
    • 📪TrackManager
    • 📪LapTimeTrackingObject
    • 📪TrackPoint
    • 📪TimeTrialUIManager
    • 📪TimeTrialSaveManager
    • 📪TTSystem
  • Internal Classes
    • 📪Sector
    • 📪LapTimeTrackingEditor
Powered by GitBook
On this page
  • How To Add Pre-Built Time Trial UI:
  • Modifying TimeTrialUIManager To Make Use Of Your Own UI:
  • Creating A Custom Time Trial UI Script:
  • What Next?
  1. Guides

Adding Time Trial UI

Guide

Last updated 1 month ago

How To Add Pre-Built Time Trial UI:

To add in-game UI of relevant time trial data into your project, simply drag the TimeTrialUIManager prefab into your scene.

This will automatically display time trial UI for you, but the data will not be saved. This means that relaunching the game will reset the UI such as personal best lap time.

To add this, see the '' guide.

Modifying TimeTrialUIManager To Make Use Of Your Own UI:

To use your own custom (and much better looking) UI, simply modify the component to use your own UI elements by changing its references. By default, the references UI objects from the TimeTrialUI prefab.

[Header("Time Trial UI Elements:")]
[SerializeField] private TextMeshProUGUI currentLapTimeText;
[SerializeField] private TextMeshProUGUI bestLapTimeText;
[SerializeField] private Transform sectorTimeContainer;
[SerializeField] private GameObject sectorTimePrefab;

Creating A Custom Time Trial UI Script:

If you need more flexibility, you can also create a custom script to handle your time trial UI instead. This is slightly more complicated as the automatically references the component so that it works right away.

This is a small change and simply requires changing any references to the in the to make use of your own script instead.

In :

// Replace declaration with your own script reference
private TimeTrialUIManager timeTrialUI;

// Replace initialization with own logic
timeTrialUI = FindObjectOfType<TimeTrialUIManager>();

// Change all other references in LapTimeTrackingObject.cs

What Next?

Time trial data can also be accessed by referencing the component on the script where you want to access that data.

See and sections for more information on how to do this.

📪
Adding Time Trial Saves
TimeTrialUIManager
TimeTrialUIManager
LapTimeTrackingObject
TimeTrialUIManager
TimeTrialUIManager
LapTimeTrackingObject
LapTimeTrackingObject.cs
LapTimeTrackingObject
Accessing Time Trial Data
LapTimeTrackingObject
How do I make time trial data save across game sessions?
How do I access time trial data to use in my own UI?