StopVehicleDriving

Description

When this method is called, the vehicle passed as a parameter is no longer controlled by the Traffic System until it is out of view and respawned.

The steering and the engine will no longer be controlled by the system, only the suspensions will continue to work.

Declaration

public static void StopVehicleDriving(GameObject vehicle)

Parameters

NameDescription

vehicle

The vehicle to be removed from the Traffic System.

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 StopDriving()
    {
        //instead of Find use a reference to the vehicle gameobject
        API.StopVehicleDriving(GameObject.Find("Sedan(Clone)0"));
    }
}

Last updated