GetVehicleComponent
Description
Declaration
public static VehicleComponent GetVehicleComponent(int vehicleIndex)Parameters
Name
Description
Returns
Example
using Gley.TrafficSystem;
using UnityEngine;
public class Test : MonoBehaviour
{
//a reference to vehicle pool and player assigned in inspector
public VehiclePool vehiclePool;
public Transform player;
void Start()
{
API.Initialize(player, 20, vehiclePool);
}
public void ExcludeVehicle()
{
//get the vehicle component from the vehicle with index 0 and debug its max speed
VehicleComponent component = API.GetVehicleComponent(0);
if (component != null)
{
Debug.Log(component.GetMaxSpeed());
}
}
}Last updated