> 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/removepedestrian.md).

# RemovePedestrian

### Description

Remove a specific pedestrian from the scene bypassing the remove conditions of the Pedestrian System.

The removed pedestrian will be instantiated again when requested by the Pedestrian System.

### Declaration

```csharp
public static void RemovePedestrian(int pedestrianIndex)
```

### Parameters

<table><thead><tr><th width="261">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>pedestrianIndex</strong></td><td>The index of the pedestrian.</td></tr></tbody></table>

### Example

```csharp
using Gley.PedestrianSystem;
using UnityEngine;
public class Test : MonoBehaviour
{
    // A reference to the pedestrian pool and player assigned in the inspector.
    public PedestrianPool PedestrianPool;
    public Transform Player;

    void Start()
    {
        API.Initialize(Player, 1, PedestrianPool);
    }

    public void AddPedestrian()
    {
        // Add a pedestrian close to the player.
        API.AddPedestrian(Player.position, PedestrianTypes.Normal,CompleteMethod);
    }

    private void CompleteMethod(Pedestrian pedestrianCOmponent, int waypointIndex)
    {
        Debug.Log($"Pedestrian {pedestrianCOmponent.name} was added to waypoint {waypointIndex}");
    }

    public void RemovePedestrian()
    {
        // Remove the pedestrian with index 0.
        API.RemovePedestrian(0);
    }

    // Used for demonstration purposes.
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            AddPedestrian();
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            RemovePedestrian();
        }
    }
}
```
