> For the complete documentation index, see [llms.txt](https://fish-networking.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/playerspawner.md).

# PlayerSpawner

## Description <a href="#server-and-host" id="server-and-host"></a>

The **PlayerSpawner** component in FishNet is responsible for spawning player objects for clients when they connect to the server. You set the player prefab using the inspector or via the `SetPlayerPrefab` method. You can also define an array of spawn points (Transforms) for players (the **Spawns** array). If no spawn points are set, the prefab’s own position and rotation are used. You also have access to the `OnSpawned` event that fires on the server when a player is spawned.

{% hint style="success" %}
Check out the API page for specific fields and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Spawning.PlayerSpawner.html).
{% endhint %}

## Settings <a href="#server-and-host" id="server-and-host"></a>

<div align="left"><figure><img src="/files/amfY0bG3cf2IeJ47THe3" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>

### :gear: **Player Prefab**

> This is used to select the prefab this component will instantiate for clients when they connect to the server.

### :gear: **Add to Default Scene**

> This is used to add a client to the active scene when no global scenes are specified through the [FishNet SceneManager](/docs/guides/features/scene-management.md). This is important because FishNet doesn't force a client to start in the same scene as the server, so FishNet needs to be told if a client should observe a specific scene and receive information about the Network Objects in that scene.

### :gear: **Spawns**

> This is a list of GameObject Transforms that the **PlayerSpawner** will use as locations to spawn the players at. It will use them in order, one after another, looping once it reaches the final one. If none are given, then it will use the prefab's base position.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/playerspawner.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
