> For the complete documentation index, see [llms.txt](https://gley.gitbook.io/mobile-traffic-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gley.gitbook.io/mobile-traffic-system/complete-api/getallvehicles.md).

# GetAllVehicles

### Description

Get a list of all vehicles used by the Traffic System.

Useful for setting up specific properties for each vehicle.

### Declaration&#x20;

```csharp
public static VehicleComponent[] GetAllVehicles()
```

### Returns

**VehicleComponent\[]** - An array with all vehicle components.

### Example

```csharp
using Gley.TrafficSystem;
using System.Collections.Generic;
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 GetVehicleList()
    {
        var allVehicles = API.GetAllVehicles();

        foreach (VehicleComponent vehicle in allVehicles)
        {
            //do something with the vehicle.
        }
    }
}

```
