📪Manual Setup
Guide
The manual setup section is a step by step guide on how to get the Complete Time Trial System package up and running into your project quickly, but without the use of the pre-packaged TTSystem prefab.
This guide assumes that you have already imported the Complete Time Trial System package into your project.
NOTE: The minimum 3 components needed to quickly setup time trials are the TrackManager, LapTimeTrackingObject and the TrackPoint components.
Add a TrackManager component to an object in your scene. This component holds the data for your track and you must have one for every track in your project.
This is where you will set the track properties for the time trial system to use. E.g: Name, TrackType.
To keep things clean, it is recommended to add this component on a parent object and then have any TrackPointPrefabs for that track as children of this. That way, all information for a track is grouped nicely together.
Set the TrackType parameter on the TrackManager to either linear or circular based on the layout of your track. (See TrackManager for a breakdown of each type of track).
(Optional) Set the track name field to the name of your track.
Drag a TrackPoint3DPrefab or TrackPoint2DPrefab depending on your type of project into the scene and position it at the start line of your track. Adjust the dimensions of its trigger to fit your track.
If using a linear track type, drag another TrackPointPrefab into your scene to represent your finish line.
If using a circular track type, add several TrackPointPrefabs around your track to prevent cheating.
Using only one TrackPointPrefab on a CIRCULAR track means that players can start a lap and reverse back to the start line to complete the lap.
Add checkpoints around the track by adding more TrackPointPrefabs to ensure times are valid and prevent cheating.
(Optional) Add as many more TrackPointPrefabs as you want around your track to create timed sectors around the track. (See TrackPoint)
CAUTION: Collider types of LapTimeTrackingObject and TrackPointPrefabs must match for OnTriggerEnter/OnTriggerEnter2D callbacks to be registered which is required to calculate lap times.
Populate the list of track points on the TrackManager with the TrackPointPrefab objects that you added into your scene for that track. This list should be filled in the order in which you want these objects to be passed by your player. For example:
Start line TrackPointPrefab = Index 0 in TrackPoints list
Second TrackPointPrefab = Index 1 in TrackPoints list
Add a LapTimeTrackingObject to the object(s) that you wish to use time trials for. These are any objects that you wish to be timed whilst going around a track.
The object(s) that you add this component to MUST have a collider and rigidbody attached and be of the same type as your TrackPointPrefab objects (both 2D or both 3D).
DONE!
Complete a lap with your LapTimeTrackingObject. Time trial logic is now setup correctly and can be tested by navigating to your LapTimeTrackingObject component while your game is running.
If everything is setup correctly, you will see time trial data being displayed as text in the inspector and being updated in real-time as you complete the lap.
What Next?
Last updated