Initialize
Description
Initializes the entire Traffic System by adding all the necessary components before starting the Traffic System.
This method should be called only once at the beginning of the scene.
Declaration
Supports multiple declarations based on the needs.
public static void Initialize(Transform activeCamera, int nrOfVehicles, VehiclePool vehiclePool)
public static void Initialize(Transform activeCamera, int nrOfVehicles, VehiclePool vehiclePool, TrafficOptions trafficOptions)
public static void Initialize(Transform[] activeCameras, int nrOfVehicles, VehiclePool carPool, TrafficOptions trafficOptions)Parameters
activeCamera
Camera that follows the player or the player itself. Used to determine the line of sight for vehicle instantiations.
nrOfVehicles
The maximum number of traffic vehicles that can be active simultaneously. This value cannot be increased later during runtime.
vehiclePool
Available vehicles asset. More details about the Vehicle Pool, including its configuration can be found in Setup Guide: Vehicle Pool
trafficOptions
A TrafficOptions object used to store the initialization properties.
activeCameras
Cameras that follow the players. Utilized in multiplayer scenarios.
Example
Initializing the Traffic System inside a scene.
Last updated