Files
agame_for_unity/Docs/FishNet-Documentation-main/fishnet-building-blocks/components/prediction/predictedspawn.md
T
2026-09-20 15:53:11 +08:00

2.2 KiB

description
description
The PredictedSpawn component allows you to spawn this Network Object directly on the client side.

PredictedSpawn

Description

Adding this component to a NetworkObject will allow you to adjust predicted spawning settings for the object. To enable this feature you must also enable predicted spawning within the ServerManager.

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. {% endhint %}

Settings

Default settings

⚙️ Allow Spawning

This allows clients to predicted spawn this object. You can change this at run-time with the SetAllowSpawning method. Just be sure to do so on the client and server side.

⚙️ Allow Despawning

This allows clients to predicted despawn this object. You can change this at run-time with the SetAllowDespawning 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.md {% endhint %}