> For the complete documentation index, see [llms.txt](https://gley.gitbook.io/mobile-pedestrian-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-pedestrian-system/complete-api/initialize.md).

# Initialize

### Description

Initializes the entire Pedestrian System by adding all the necessary components before starting the Pedestrian System.

This method should be called only once at the beginning of the scene.

### Declaration

```csharp
public static void Initialize(Transform activeCamera, int maxNumberOfPedestrians, PedestrianPool pedestrianPool)

public static void Initialize(Transform activeCamera, int maxNumberOfPedestrians, PedestrianPool pedestrianPool, PedestrianSystemOptions options)

public static void Initialize(Transform[] activeCameras, int maxNumberOfPedestrians, PedestrianPool pedestrianPool, PedestrianSystemOptions options)
```

### Parameters

<table><thead><tr><th width="261">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>activeCamera</strong></td><td>Camera that follows the player or the player itself. Used to determine the line of sight for pedestrian instantiations.</td></tr><tr><td><strong>maxNumberOfPedestrians</strong></td><td>Maximum number of pedestrians active at the same time. This value cannot be increased during runtime. </td></tr><tr><td><strong>pedestrianPool</strong></td><td>Available pedestrians asset. More details about the Pedestrian Pool, including its configuration can be found in the Setup Guide: <a data-mention href="/mobile-pedestrian-system/setup-guide/pedestrian-pool.md">Pedestrian Pool</a></td></tr><tr><td><strong>options</strong></td><td>A <a data-mention href="/mobile-pedestrian-system/complete-api/pedestriansystemoptions.md">PedestrianSystemOptions</a>object, used to store the initialization properties.</td></tr><tr><td><strong>activeCameras</strong></td><td>Cameras that follow the players. Utilized in multiplayer scenarios.</td></tr></tbody></table>

### Example

```csharp
using Gley.PedestrianSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    // References to the pedestrian pool and player assigned in the inspector.
    public PedestrianPool pedestrianPool;
    public Transform player;

    void Start()
    {
        // Set initialization parameters. if not assigned the default value will be used.
        PedestrianSystemOptions options = new PedestrianSystemOptions()
        {
            activeSquaresLevel = 2,
            distanceToRemove = 150,
            minDistanceToAdd = 100
        };

        API.Initialize(player, 20, pedestrianPool, options);
    }
}
```
