For the complete documentation index, see llms.txt. This page is also available as Markdown.

AddExcludedVehicleToSystem

Description

Excluded vehicles are a special kind of vehicle marked as Don't Instantiate inside the Vehicle Pool. These vehicles will not be instantiated by the system unless the user specifies to be instantiated using this method. Read more about them Add vehicles to the pool

The AddExcludedVehicleToSystem adds a previously excluded vehicle back to the Traffic System and the vehicle behaves normally.

Declaration

public static void AddExcludedVehicleToSystem(int vehicleIndex)

Parameters

Name
Description

vehicleIndex

Index of the vehicle to be added back to the 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 AddVehicle()
    {
        //0 - is an example index of the vehicle
        API.AddExcludedVehicleToSystem(0);
    }
}

Last updated