Tracker
The Tracker component enables a vehicle to track and store targets in the scene.

Setting Up The Tracker

Make sure you have a Trackable Scene Manager component somewhere in the scene to enable target tracking to work.
To set up a vehicle to track targets, simply add a Tracker component to the root transform.
The Tracker component's inspector comes with a full range of settings you can customize, including:
  • Tracking range
  • The target types to track
  • The target teams to track
  • Line of sight checking

Accessing Target Information

The Tracker component stores target information in its 'Targets' list, which can be accessed by other scripts on the vehicle:
1
// Get the targets list from a Tracker component
2
List<Trackable> targets = myTracker.Targets;
Copied!

Detecting Target Appearance Or Disappearance

Sometimes you may want to do something when a target (or a specific target) first starts getting tracked by the radar, or when it stops being tracked by the radar.
The Tracker component has a function OnStartedTracking that you can override, as well as an event onStartedTracking that you can add functions to.
Also, the Tracker component has a function OnStoppedTracking that is called when a target stops being tracked by radar, as well as an event onStoppedTracking that you can add functions to.

Target Notification

If you want a target to know when it is being tracked, you can set this up wit the following steps:
  1. 1.
    Add a Tracker Notification Emitter component to the vehicle doing the tracking.
  2. 2.
    Add a Trackable Notification Receiver to the target being tracked.
This passes information about the specific Game Agent doing the tracking, enabling you to check if it's the player etc.
​