> For the complete documentation index, see [llms.txt](https://infinitypbr.gitbook.io/magic-pig-games/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitypbr.gitbook.io/magic-pig-games/projectile-factory/projectile-factory-documentation/spawn-point-manager.md).

# Spawn Point Manager

Each [**Projectile Spawner**](/magic-pig-games/projectile-factory/projectile-factory-documentation/projectile-spawner.md) can have any number of *Spawn Points*. These are the points where Projectiles will be created.

The `SpawnPointManager` is a class which handles how each Spawn Point is used.&#x20;

<figure><img src="/files/iUx6P3lPvT4Kb6NoBzGc" alt=""><figcaption><p>Here we have two spawn points, and one Manager.</p></figcaption></figure>

The default `SpawnPointManager` simply moves from one Spawn Point to the next sequentially, as shown in the code below. You can create a new class which inherits from this in order to customize how your Spawn Points are selected.

```csharp
namespace MagicPigGames.Projectiles
{
    [CreateAssetMenu(fileName = "New Sequential Spawn Points", menuName = "Projectile System/Spawn Point Managers/Sequential Spawn Points")]
    [System.Serializable]
    public class SpawnPointManager : ScriptableObject
    {
        public virtual int NextSpawnPointIndex(ProjectileSpawner projectileSpawner, int value = 1)
        {
            if (projectileSpawner.spawnPoints.Count == 0)
                throw new InvalidOperationException("There are no spawn points available.");

            projectileSpawner.SpawnPointIndex += value;
            
            if (projectileSpawner.SpawnPointIndex < 0)
                projectileSpawner.SpawnPointIndex += projectileSpawner.spawnPoints.Count;
            projectileSpawner.SpawnPointIndex %= projectileSpawner.spawnPoints.Count;

            return projectileSpawner.SpawnPointIndex;
        }
    }
}
```

**Your game is unique!** And your Spawners are unique as well! Customizing how the Spawn Points are selected is a powerful tool.

## Customization Scenario

As an example, perhaps your spawner has multiple spawn positions, and they sequentially fire as in the default `SpawnPointManager` -- except that each one can be destroyed by the player. As the player destroys them, you may wish to skip over the ones that have been destroyed.
