Custom Vehicle Controller
  • Custom Vehicle Controller
  • Guides
    • Workflow
      • Quick Setup
      • Creating New Parts
      • Modifying Parts
      • Creating Vehicle Parts Presets
      • Customizable Sets and Runtime Parts Change
      • Engine Performance Customization
      • Exposing Current Car Stats
    • API
      • CustomVehicleController
      • VehicleEngineSoundManager
      • RaceManager
      • RacerProgress
      • RaceSpawner
      • CollisionHandler
    • Vehicle Controller Input Provider
      • Input System Example
      • Mobile Input
    • Tips, Warnings and Requiremens
      • Work With Editor
      • Vehicle Set Up
    • AI Setup
      • AI Racer Creation
      • AI Racer Setup
      • AI Chaser Setup
      • Race Creation
      • Race Configuration
      • Race Information
    • Vehicle Damage System
      • Vehicle Damage Controller
      • Collision Area Partitioner
      • Part Damage Handler
      • Vehicle Attachments Aligner
      • Collision Handler
    • Additional Settings
      • Custom Vehicle Controller
      • Car Visuals Essentials
    • Package Settings
      • Assets Save Location
      • Project-Wide Surface Settings
    • Extra
      • Adding Visual Effects
        • Individual Effect Set Up
      • Adding Sound Effects
        • Adding Engine Sound
        • Adding Extra Sound Effects
  • Converting To Other Render Pipelines
    • Convert To Built-in RenderPipeline
    • Convert To HDRP RenderPipeline
Powered by GitBook
On this page
  • Race Events
  • Race Data
  • RacerProgress
  1. Guides
  2. AI Setup

Race Information

PreviousRace ConfigurationNextVehicle Damage System

Last updated 1 year ago

You can access some information about the race from UnityEvents and from code.

Race Events

The conditions for events to happen are self-explanatory. To subscribe to an event, click on the "+" button under it, drag and drop a game object with script that contains a method that you want to be called and select the method:

The "On Player Finished" event also return an integer that represent the position of the player among the racers. To pass this integer into your method (the method should accept an int), select method from the top of the popup window (under "Dynamic int").

You can also subscribe to these events from code.

  1. Add a "using" directive for "Assets.VehicleController"

  2. Get a reference to the "RaceManager" component.

  3. Access the race manager object's event and call the "AddListener" method, passing a method into it.

Race Data

Besides events, which give you substantial information about the race progress, you can also access some methods and fields to find out more information

Method
Description

GetLeaderboard()

Property
Description

StartCountdownTimeLeft

The amount of seconds (float type) left before a race will start.

WaitForOtherRacersTimeLeft

The amount of seconds (float type) left after the podium places have been taken before a race will end.

RacerProgress

RacerProgress is an object created for every vehicle that registered for participation in a race.

It contains the following information:

Field
Description

IsPlayer

RacerName

The name of the root game object of the vehicle.

RacerProgressNormalized

A percentage of the progress on the current lap. Doesn't get updated after the racer finishes the race.

LapsPassed

The amount of laps completed by the racer.Doesn't get updated after the racer finishes the race.

FinishedRace

Returns True if the amount of finished laps is higher than the amount of laps in a race.

Returns a sorted (ordered by the progress counting the number of laps finished) List of type "".

Returns true if the racer is a player. A racer is a player if the is set to True.

RacerProgress
"RaceParticipant" component's property "IsPlayer"