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
  • Adding A New Track In A New Scene:
  • Adding New Tracks To The Same Scene:
  • What Next?
  1. Guides

Adding New Tracks

Guide

Last updated 1 year ago

Tracks are defined by their TrackManager component. Every track must have its own component to represent its layout.

Adding A New Track In A New Scene:

  • By default, the Complete Time Trial System package is setup to work with one track per Unity scene as it uses automatic assignment of references to prevent needing to manually assign components.

    • This is done using FindObjectOfType<TrackManager>() in Awake of LapTimeTrackingObject so fails with more than one TrackManager in the scene.

  • This has the benefit of being easy to use at the downside of flexibility. Should you prefer having multiple tracks per scene or a more flexible solution see the section below to see how to handle reference assignment manually instead.

  • For adding time trials to a new track in a new scene, simply add a component in that scene, and create the layout of your track as normal.

in :

private TrackManager currentTrackManager; // Declaration

currentTrackManager = FindObjectOfType<TrackManager>(); // Assignment in Awake()

Adding New Tracks To The Same Scene:

  • To add multiple tracks in the same scene, simply modify the reference in to not use FindObjectOfType but instead your own method of choice for assignment.

  • This can either be done manually by assigning the references in inspector or through a script that updates the reference as you change track in game.

  • This can also be used to provide much more flexibility for time trials in your projects and allows you to update the reference for individual at any point during gameplay.

  • For example, you could have 2 races going on simultaneously in the same Unity scene each making use of time trials for their own on each track.

What Next?

📪
How do I add time trial UI to my project?
How do I make time trial data save across game sessions?
TrackManager
TrackManager
LapTimeTrackingObject.cs
TrackManager
LapTimeTrackingObject
TrackManager
TrackManager
LapTimeTrackingObjects
LapTimeTrackingObjects
Adding New Tracks To The Same Scene