SetTrafficDensity
Description
Declaration
public static void SetTrafficDensity(int nrOfVehicles)Parameters
Name
Description
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 ChangeDensity()
{
//the parameter needs to be <= 20 since the initialization declared a maximum number of 20 vehicles
API.SetTrafficDensity(10);
}
}
Last updated