# PredictedSpawn

## Description

Adding this component to a [NetworkObject](/docs/guides/features/networked-gameobjects-and-scripts/networkobjects.md) will allow you to adjust [predicted spawning](/docs/guides/features/networked-gameobjects-and-scripts/spawning/predicted-spawning.md) settings for the object. To enable this feature you must also enable predicted spawning within the [ServerManager](/docs/fishnet-building-blocks/components/managers/server-manager.md).

The **PredictedSpawn** component allows you to inherit from it and then override any of several available virtual methods to customize and validate predicted spawns.

{% hint style="success" %}
Check out its full API page for the specific methods [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedSpawn.html).
{% endhint %}

## Settings

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

### :gear: **Allow Spawning**

> This allows clients to predicted spawn this object. You can change this at run-time with the [`SetAllowSpawning`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedSpawn.html#FishNet_Component_Ownership_PredictedSpawn_SetAllowDespawning_System_Boolean_) method. Just be sure to do so on the client and server side.

### :gear: **Allow Despawning**

> This allows clients to predicted despawn this object. You can change this at run-time with the [`SetAllowDespawning`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedSpawn.html#FishNet_Component_Ownership_PredictedSpawn_SetAllowDespawning_System_Boolean_) method. Just be sure to do so on the client and server side.

{% hint style="info" %}
You can implement WritePayload and ReadPayload in your classes which inherit NetworkBehaviour to send data with spawn messages. This can even be used for predicted spawns to the server, and clients!

Learn more about that here: [Spawn Payloads](/docs/guides/features/networked-gameobjects-and-scripts/spawning/spawn-payloads.md)
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/prediction/predictedspawn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
