新增FishNet文档

This commit is contained in:
2026-09-20 15:53:11 +08:00
parent c403145db9
commit 179c282405
431 changed files with 15476 additions and 0 deletions
@@ -0,0 +1,11 @@
---
description: >-
Components are included scripts which you may attach to your objects for
additional functionality.
---
# Components
Many components aim to make development easier, and quicker. For example, if you wish to synchronize animations, you attach the NetworkAnimator component. There are a wide variety of components to choose from.
Pages within this section summarize what each component accomplishes as well provides more in-depth knowledge to the component's settings. A few select components which offer a significant amount of functionality are covered in the [Guides](https://fish-networking.gitbook.io/docs/guides/high-level-overview).
@@ -0,0 +1,31 @@
---
description: >-
ColliderRollback allows an object's colliders to be rolled back for lag
compensation.
---
# ColliderRollback (Pro Feature)
## Description
This component is used for rolling back colliders on objects for the purpose of lag compensation. You can find out more about it in the dedicated guide for this feature: [raycast.md](../../guides/features/lag-compensation/raycast.md "mention")
## Settings
<div align="left"><figure><img src="../../.gitbook/assets/collider-rollback-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Bounding Box**
> This configures how a bounding box is added to the object. When set to **Disabled** a bounding box will not be added. Additional settings are displayed when not set to **Disabled**.
### :gear: **Physics Type**
> This is which type of physics you plan on rolling back, and determines if a Physics collider is added, or Physics2D collider.
### :gear: **Bounding Box Size**
> This determines how large of a bounding box to add. Typically a value three times larger than the world space of your object is sufficient. For example, if your object is a Vector3.one cube, this value would Vector3(3f, 3f, 3f). If an object is exceptionally fast moving consider making this larger.
### :gear: **Collider Parents**
> These are transforms you wish to send back in time when performing a rollback. For best results put your hitboxes on their own transform, which is a child of the object the hitbox is for. A setup example is rovided as a demo within `FishNet\Demos\ColliderRollback`.
@@ -0,0 +1,9 @@
---
description: >-
Manager components are generally only added once per NetworkManager and play a
vital role on configuring your project.
---
# Managers
The [NetworkManager](network-manager.md) will automatically add the needed manager components to itself at run-time, if they aren't already added. You can add them yourself to customize their settings in the editor.&#x20;
@@ -0,0 +1,33 @@
---
description: The ClientManager provides settings unique to clients.
---
# ClientManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **ClientManager** is FishNet's primary orchestrator for client-side networking, managing connections, state, event handling, and all data flow between the local client and the server.
It maintains a reference to the network connection of the local client, `Connection`, keeps track of all known networked objects on the client through `ClientObjects`, as well as optionally tracks all currently connected clients (when [server ID sharing](server-manager.md#share-ids) is enabled), using a dictionary of client connections. The ClientManager also has many useful events, such as when a client is authenticated and when the local client or a remote client changes their network state. It also is used for sending [broadcasts](../../../guides/features/network-communication/broadcasts.md) to the server.
When enabled, this component will also timeout the client from the server if the server doesn't respond after a set time.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Client.ClientManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left" data-full-width="false"><figure><img src="../../../.gitbook/assets/client-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Remote Server Timeout**
> This decides if the client should disconnect when the server seems unresponsive. This feature can be set to **disabled**, work in **development** and releases, or only **releases**.
>
> * **Timeout** is how long the server must be unresponsive before they are kicked.
### :gear: **Change Frame Rate**
> While enabled, this will change the frame rate limitation when acting as client only.
>
> * **Frame Rate** is the frame rate to use while only the client is active. There is also a setting for client frame rate on the [ServerManager](server-manager.md). When both client and server are active the higher of the two frame rates will be used.
@@ -0,0 +1,47 @@
---
description: >-
The DebugManager helps you debug various networking functions when in the
Unity Editor or Development builds.
---
# DebugManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **Debug Manager** component can be used to gain extra information and temporarily tweak certain networking aspects to assist in debugging errors in your game. For example, if you are running into Scene ID errors you can enable the Detailed Writing of Scene Objects to know the object names instead of just IDs. These settings often come at the cost of a little more bandwidth used and are only enabled in the Editor and Development builds of your game.
{% hint style="warning" %}
Note that having a DebugManager with some of its settings enabled can cause issues when connecting non-development builds to development ones (including the editor).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/debug-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Scene Objects**
> This adds information about scene objects instead of just sending IDs. You can use this when debugging missing sceneId / spawn-related issues.
### :gear: **RPC Lengths**
> This will validate written versus read length of RPCs when enabled. Use in development to detect serialization mismatches in RPCs (written length vs read length).
### :gear: **ObserversRpcs**
> This disables ObserverRpc links.
### :gear: **TargetRpcs**
> This disables TargetRpc links.
### :gear: **ServerRpcs**
> This disables ServerRpcs links.
### :gear: **ReplicateRpcs**
> This disables ReplicateRpc links.
### :gear: **ReconcileRpcs**
> This disables ReconcileRpc links.
@@ -0,0 +1,50 @@
---
description: >-
The NetworkManager is an essential component for running the client and
server. It acts as a bridge between core components and configuring your
network.
---
# NetworkManager
## Description
The **NetworkManager** is the central component of FishNet that manages the networking lifecycle, including establishing connections, hosting sessions, and handling client-server communication. Although this component manages the network, it should not itself be a networked object, and must not contain a [Network Object](../network-object.md) component on the same object, or as a parent or child of it. Additionally, the Network Manager can be used to register components and access them directly from it. This can be useful for other manager like scripts.
The Network Manager utilizes several sub-manager components, which it will add at runtime if they do not already exist on the object.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.NetworkManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/network-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Run In Background**
> This allows the application to run in the background when true. Running in the background is often essential for clients, and especially for the server.
### :gear: **Don't Destroy On Load**
> This will ensure the Network Manager persist between scene changes. If you are using only one Network Manager it's best to leave this true.
### :gear: **Persistence**
> This option specifies how to behave when multiple NetworkManagers exist in your game.
### :gear: **Logging**
> This lets you specify what actions to log for builds, editor, and headless mode. When the field is not populated, the default logging settings are used. To make a custom logging settings open your create menu and choose: **Tools > Fish-Networking > Logging > Logging Configuration.**
### :gear: **Spawnable Prefabs**
> This option dictates which prefabs collection to use for networked objects. By default this field is automatically set to DefaultPrefabObjects for any saved scene; you can however make your own PrefabObjects class with customized rules and applications.
### :gear: **Object Pool**
> Which object pooling script to use. When not set, DefaultObjectPool is added automatically at run-time. You may inherit from ObjectPool to create your own.
### :gear: **Refresh Default Prefabs**
> While true, this will refresh the DefaultPrefabCollection every time play mode is entered. This is generally not needed to be enabled, but can be useful if your prefab collection is regularly becoming corrupted through symlinks.
@@ -0,0 +1,61 @@
---
description: >-
The ObserverManager assists in controlling what network objects each client
may see.
---
# ObserverManager
## Description <a href="#server-and-host" id="server-and-host"></a>
**ObserverManager** is used to globally customize the observer system. Observer conditions within the ObserverManager will be automatically added to [NetworkObjects](../../../../guides/features/networked-gameobjects-and-scripts/networkobjects/), unless the [NetworkObserver](../../network-observer.md) component is set to ignore the manager.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Observing.ObserverManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../../.gitbook/assets/observer-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Update Host Visibility**
> This will hide renderers on networked objects which are hidden to host client. When false, all networked objects will be visible to the host client even if these objects would normally be despawned for the client.
### :gear: **Maximum Timed Observers Duration**
> The maximum duration that the server will take to update timed observer conditions as server load increases. Lower values will result in timed conditions being checked quicker at the cost of performance.
### :gear: **Default Conditions**
> These are [Observer Conditions](../../../scriptableobjects/observerconditions/) which will be added to all NetworkObjects by default.
>
> Almost all games should utilize at least the [Scene Observer Condition](../../../scriptableobjects/observerconditions/scenecondition.md).
### :gear: Use **Level of Detail**
> This will enable the [LOD system](../../../../guides/features/level-of-detail.md) and show the options for configuring it. It requires [FishNet Pro](../../../../guides/updating-fishnet/upgrading-to-fishnet-pro.md).
### :gear: Maximum Send Interval
> The upper limit for how long (in seconds) the system will wait between updates for objects in the furthest LOD bracket. If set to `5`, the most distant objects will only receive updates once every 5 seconds.
### :gear: Recalculation Duration
> This determines how quickly (in seconds) the server cycles through objects to update their current LOD status.
>
> This value scales automatically if the server's frame rate is capped. Lower values are generally more ideal to ensure objects transition between LOD brackets responsively.
>
> Use `SetLevelOfDetailRecalculationDuration(float duration)` if you want to adjust this value at run-time.
### :gear: **Level of Detail Distances**
> This is a list of distance thresholds. Each entry defines a "bracket" for synchronization frequency.
>
> _Example:_ If you have two distances set to `5` and `15`, FishNet will run with the following setup:
>
> * Near (< 5 units): Objects sync at the standard, full-speed interval.
> * Mid (5 to 14.9 units): Objects sync at a reduced "mid-tier" frequency.
> * Far (≥ 15 units): Objects sync at the maximum allowed delay.
>
> The system uses an **exponential scaling** method to determine how often updates are sent for each distance bracket. This ensures a smooth transition between high-frequency updates for nearby objects and low-frequency updates for distant ones.
@@ -0,0 +1,23 @@
---
description: >-
The HashGrid is the managing script for when using the Grid Observer
Condition.
---
# HashGrid
## Description
The **HashGrid** is required when using the [Grid Condition](../../network-observer.md). This component is responsible for managing the grid and providing information to grid objects. While grids are less accurate than using the [Distance Condition](../../../scriptableobjects/observerconditions/distancecondition.md) they do provide better performance. HashGrid must be placed on or beneath the [NetworkManager ](../network-manager.md)object.
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/hash-grid-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Grid Axes**
> These are which axes to base the grid on. Whichever axis is excluded will not have it's values considered in calculations. For example, if you are developing a 2D game most likely only XY matters, so you would choose the XY axes.
### :gear: **Accuracy**
> This determines how close a client's [FirstObject](https://fish-networking.com/FishNet/api/api/FishNet.Connection.NetworkConnection.html#FishNet_Connection_NetworkConnection_FirstObject) must be (in Unity units) to be considered in range. Note that accuracy is not as precise as when using a [Distance Condition](../../../scriptableobjects/observerconditions/distancecondition.md).
@@ -0,0 +1,39 @@
---
description: >-
The PredictionManager provides states, callbacks, and settings to fine tuning
prediction for your game type.
---
# PredictionManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **PredictionManager** is a core component responsible for managing the prediction system, which allows clients to predict their own actions and then reconcile (correct) their state when authoritative updates are received from the server. It allows you to tweak various global prediction settings and get certain prediction callbacks.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Predicting.PredictionManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/prediction-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: Create Local States
> When enabled this allows the client to create local reconcile states which means reconciles can be sent less frequently and provide data to use for reconciles when packets are lost.
### :gear: State **Interpolation**
> This is how many states to try and hold in a buffer before running them on clients. Larger values add resilience against network issues at the cost of running states later.
### :gear: State **Order**
> The order in which clients run states. **Future** favors performance and does not depend upon reconciles, while **Past** favors accuracy but clients must reconcile every tick.
### :gear: **Drop Excessive Replicates**
> Toggle the setting to true to drop excessive client replicates, helping prevent attacks but risking temporary desynchronization during connectivity issues. Set to false to store up to 3 seconds of replicates, processing multiple per tick for quicker cache clearing. This approach ensures all inputs are executed but could enable speed hacking. When false, replicated data is consumed more quickly if the cache limit is exceeded.
### :gear: Maximum Server Replicates
> This is shown when the **Drop Excessive Replicates** is enabled. This value indicates the maximum number of replicates which the server will cache from client before dropping old ones. Higher values will reduce the chance of dropped input when the client's connection is unstable, but will potentially add latency to the client's object both on the server and client. Generally, cached replicates will never significantly exceed Queued Inputs.
@@ -0,0 +1,31 @@
---
description: >-
RollbackManager contains configurations and optimizations for how colliders
are sent back in time when using lag compensation.
---
# RollbackManager (Pro Feature)
## Description <a href="#server-and-host" id="server-and-host"></a>
The RollbackManager must be added and configured properly for lag compensation to function properly. Objects you wish to rollback must contain the[ ColliderRollback](../colliderrollback.md) script on them. You can learn more about using it on this page: [lag-compensation](../../../guides/features/lag-compensation/ "mention")
{% hint style="success" %}
Check out its API page for more specific methods [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.ColliderRollback.RollbackManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/rollback-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Bounding Box Layer**
> This is the layer to first test against before rolling back colliders. When a layer is specified a collider will be added to your [ColliderRollback](../colliderrollback.md) objects; because of this, be sure to use a layer which has no physics intersections and is not used for anything else.
### :gear: **Maximum Rollback Time**
> This is the maximum of seconds colliders may rollback. Using a value of 1f would allow colliders to rollback at most one second in the past, which is a very reasonable amount of time given typical player latencies are less than 100ms.
### :gear: **Interpolation**
> This is the amount of interpolation you are using on your [NetworkTransform](../network-transform.md) components. Or if you are using rigidbodies with prediction this would be the **interpolation** value on the smoothing component.
@@ -0,0 +1,38 @@
---
description: >-
The SceneManager handles networking scenes between the server and clients,
including updating active scenes, addressable scenes, provide helpful
callbacks, and more.
---
# SceneManager
## Description <a href="#server-and-host" id="server-and-host"></a>
FishNet’s **SceneManager** provides robust, synchronized, and event-driven scene management for networked Unity games, ensuring all clients and the server remain in sync throughout complex scene operations. It is responsible for coordinating which scenes are loaded or unloaded across all clients and the server, ensuring synchronization and exposes many options for the loading of scenes. There are multiple guides that are worth reading about it: [scene-management](../../../guides/features/scene-management/ "mention")
The callbacks within the SceneManager are informative and quite useful, well worth looking into!
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Scened.SceneManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/scene-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Scene Processor**
> This determines how scene loads occur. When left empty the default scene processor is used. For more information on scene processing and addressables see [here.](../../../guides/features/scene-management/custom-scene-processors/addressables.md)
### :gear: **Light Probe Updating**
> This controls how light probes are updated after scenes are loaded.
### :gear: **Move Client Host Objects**
> When enabled this will move objects visible to the host client to a temporary scene rather than let them be destroyed when a scene is unloaded. Objects are then destroyed next tick by the host client. This ensures that server and client side callbacks will work properly on the moved objects.
### :gear: **Set Active Scene**
> This will allow the **SceneManager** to pick which scene to set as the active scene when loading and unloading scenes. By default global scenes are used, and if no global scenes then the clients single scene.
@@ -0,0 +1,63 @@
---
description: >-
The ServerManager handles validation of clients and a variety of settings only
applicable to the server.
---
# ServerManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **ServerManager** is a central component responsible for handling server-related data and actions. It maintains information and handles operations for server-side networked objects as well as tracking connected clients, both authenticated and unauthenticated. Additionally, it monitors client timeouts and disconnects unresponsive clients.
The **ServerManager** can be used directly to start and stop the FishNet server as well as monitor its state and send [broadcasts](../../../guides/features/network-communication/broadcasts.md) to the clients.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Server.ServerManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/server-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **SyncType Rate**
> This is the default send rate for [SyncTypes](../../../guides/features/network-communication/synchronizing/). Setting it to 0 will send updates every tick. This value can be overridden for individual SyncTypes.
### :gear: **Spawn Packing**
> This determines how well transform properties will be packed[^1] when being sent in a spawn message. If transforms spawn marginally off reducing the packing may help.
>
> These can be edited for **Position**, **Rotation** and **Scale** independently.
### :gear: **Change Frame Rate**
> When enabled, this will change the frame rate limitation when acting as server only.
>
> * **Frame Rate** is the frame rate to use while only the server is active. There is also a setting for client frame rate on the [ClientManager](clientmanager.md). When both server and client are active the higher of the two frame rates will be used.
### :gear: **Start On Headless**
> When this is enabled, FishNet will automatically start the server when loaded on a server (headless) build.
### :gear: **Remote Client Timeout**
> This decides if the server should disconnect clients which seem unresponsive. This feature can be set to disabled, work in development and releases, or only releases.
>
> * **Timeout** is how long the client must be unresponsive before they are kicked.
### :gear: **Share Ids**
> While true, this enables clients to be aware of other clients in-game and objects owned by other clients. Objects owned by other clients are only known if they are available to the local client, such as through the observer system. Client Ids are not sensitive information but leaving this option enabled will use slightly additional bandwidth.
### :gear: **Authenticator**
> This is where you can specify which [authenticator](../utilities/authenticator.md) to use. When left empty clients may join the server without specialized authentication.
### :gear: **Allow Predicted Spawning**
> This option lets prefabs and scene objects be setup to use [Predicted Spawning](../../../guides/features/networked-gameobjects-and-scripts/spawning/predicted-spawning.md). You can use this setting to enable or disable predicted spawning without having to change the settings for every object. This value may also be set at runtime. If changing at runtime be certain to also change on the client; otherwise they could be kicked for trying to use a disabled feature.
>
> * **Reserved Object Ids** is the number of ObjectIds to reserve per client for predicted spawning. Clients will start out with the specified number of Ids and receive new ones as the server validates their predicted spawning requests. For example: if this value was set to 15 and a client with a 100ms ping sent 3 predicted spawns in one tick then they would have only 12 predicted spawns left to use until the server responded with 3 new Ids, which would be approximately 50ms later.
[^1]: compressed together to save bandwidth
@@ -0,0 +1,31 @@
---
description: >-
The StatisticManager provides statics about Fish-Networking for a variety of
tasks, including monitoring network traffic.
---
# StatisticsManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **Statistics Manager** component is responsible for tracking and reporting network traffic statistics for your multiplayer game. Its **Network Traffic** can be used to gain basic information about how much network traffic your game is using. These values must be enabled for the [BandwidthDisplay](../utilities/bandwidthdisplay.md) component to function.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Statistic.StatisticsManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/statistics-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Update Interval**
> This is how often network traffic related operations occur, such as invoking update events.
### :gear: **Update Client**
> This will invoke client traffic updates when enabled.
### :gear: **Update Server**
> This will invoke server traffic updates when enabled.
@@ -0,0 +1,49 @@
---
description: The TimeManager handles and provides callbacks related to network timing.
---
# TimeManager
## Description <a href="#server-and-host" id="server-and-host"></a>
The **TimeManager** component is responsible for managing network time and tick-based systems within the networking framework. It is central to keeping networked objects synchronized in time, handling ticks, timing conversions, physics step control, and providing hooks for network-related timing events in FishNet. It does this by managing how network timing is performed, either using fixed ticks or variable intervals and by providing precise timing for sending and receiving network data, ensuring synchronization between server and clients. It also controls the physics simulation mode (manual, automatic, or disabled) to maintain consistent simulation across the network.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Timing.TimeManager.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../../.gitbook/assets/time-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Update Order**
> Controls when the TimeManager will invoke its version of Unity callbacks. BeforeTick would be a good option if you wanted to collect input in OnUpdate before the tick occurred.
### :gear: **Timing Type**
> Dictates when data is sent and read. When set to Tick data is only processed on frames which also tick. When Variable is selected data will be sent and read every frame, when available.
### :gear: **Allow Tick Dropping**
> Will let the client skip ticks when they occur several times over a single frame. This can be useful to prevent the client from running an increasing number of simulations per frame, resulting in more performance loss.
### :gear: **Maximum Frame Ticks**
> This is shown when **Allow Tick Dropping** is enabled. This value is the maximum number of ticks that can occur per frame before the client begins dropping ticks to recover performance.
### :gear: **Tick Rate**
> This is an average of how many times per second the TimeManager will invoke tick events, as well how often data may be sent or received.
### :gear: **Ping Interval**
> How often, in seconds, a user receives a ping update. A larger ping has a very small chance of server tick synchronization losing accuracy. These changes do not affect prediction.
### :gear: **Timing Interval**
> This is how many seconds between prediction timing updates. Lower values will result in marginally more accurate timings at the cost of bandwidth.
### :gear: **Physics Mode**
> The Physics Mode determines how physics are run. **Unity** will let the engine manage physics. **TimeManager** simulates physics on ticks. When using Client-Side Prediction you must use the **TimeManager** setting.
@@ -0,0 +1,42 @@
---
description: >-
The TransportManager handles talking to the transports as well sending,
receiving, and even customizing packets on the fly.
---
# TransportManager
## Description
The **TransportManager** in FishNet is a central component responsible for communicating with the underlying network transport to send and receive data. It acts as the bridge between FishNet’s networking system and the actual transport layer, enabling networked games to send/receive packets to and from clients and servers. There is also support for latency simulation for testing different network conditions.
With the TransportManager you can optionally utilize an intermediate layer to modify data before it’s sent or after it’s received (e.g., encryption, compression).
If you want to modify network data such as for encryption, or use any one of our number of transports, you will want to add this component to your [NetworkManager](../network-manager.md) game object.
{% hint style="success" %}
Check out its API page for more specific methods and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Managing.Transporting.TransportManager.html).
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/transport-manager-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Transport**
> This field indicates which [transport](../../../../guides/high-level-overview/transports.md) to use. When left empty, the default transport ([Tugboat](../../../transports/tugboat.md)) is used, or the first transport manually added to the object which the TransportManager resides.
### :gear: **Intermediate Layer**
> This is used to specify a custom [intermediate layer](intermediatelayer.md) to use.
### :gear: Latency Simulator
> These settings allow you to simulate a variety of latency scenarios on any transport.
>
> * **Enabled:** Toggles the enabled state of the simulator.
> * **Simulate Host:** When enabled, this will also simulate latency for host client.
> * **Latency:** Is the amount of latency to simulate in milliseconds.
> * **Unreliable:** Features only used for unreliable packets.
> * **Out Of Order:** The percentage chance to send an out of order packet.
> * **Packet Loss:** The chance to drop a packet.
@@ -0,0 +1,94 @@
---
description: >-
The IntermediateLayer is a pass-through for data in and out. This feature can
be used to encrypt data, inject headers, and more.
---
# IntermediateLayer
Using the IntermediateLayer is simple as overriding two methods, one for when data is sent and one for when data is received.
Below is an example included with FishNet which demonstrates using a Caesar cipher to encrypt data.
You can find this example in the Demos folder, file name **IntermediateLayerCipher.cs**.
```csharp
using FishNet.Managing.Transporting;
using System;
namespace FishNet.Example.IntermediateLayers
{
/* Below is an example of creating a basic Caesar Cipher.
* Bytes are modified by a set value of CIPHER_KEY, and then
* the original src ArraySegment is returned.
*
* It's very important to only iterate the bytes provided
* as the segment. For example, if the ArraySegment contains
* 1000 bytes but the Offset is 3 and Count is 5 then you should
* only iterate bytes on index 3, 4, 5, 6, 7. The code below
* shows one way of properly doing so.
*
* If you are to change the byte array reference, size, or segment
* count be sure to return a new ArraySegment with the new values.
* For example, if your Offset was 0 and count was 10 but after
* encrypting data the Offset was still 0 and count 15 you would
* return new ArraySegment<byte>(theArray, 0, 15); */
public class IntermediateLayerCipher : IntermediateLayer
{
private const byte CIPHER_KEY = 5;
// Decipher incoming data.
public override ArraySegment<byte> HandleIncoming(ArraySegment<byte> src, bool fromServer)
{
byte[] arr = src.Array;
int length = src.Count;
int offset = src.Offset;
for (int i = src.Offset; i < (offset + length); i++)
{
short next = (short)(arr[i] - CIPHER_KEY);
if (next < 0)
next += 256;
arr[i] = (byte)next;
}
return src;
}
// Cipher outgoing data.
public override ArraySegment<byte> HandleOutgoing(ArraySegment<byte> src, bool toServer)
{
byte[] arr = src.Array;
int length = src.Count;
int offset = src.Offset;
for (int i = offset; i < (offset + length); i++)
{
short next = (short)(arr[i] + CIPHER_KEY);
if (next > byte.MaxValue)
next -= 256;
arr[i] = (byte)next;
}
return src;
}
}
}
```
In some cases you may need to inject headers into data sent, such as if you are validating each packet with an authorization key.
If such is the case it may be wise to reserve a number of bytes needed for your header. You can do this by calling SetMTUReserve() on your TransportManager.\
\
Here is an example of doing such.
```csharp
public class MyIntermediateLayer : IntermediateLayer
{
public override void InitializeOnce(TransportManager manager)
{
base.InitializeOnce(manager);
const int bytesForMyHeader = 10;
manager.SetMTUReserve(bytesForMyHeader);
}
// ...rest omitted
```
@@ -0,0 +1,22 @@
---
description: >-
NetworkBehaviour allows your scripts to perform networked actions, such as
synchronizing data, responding to network events, and handling remote
procedure calls (RPCs).
---
# NetworkBehaviour
## Description
NetworkBehaviour(s) cannot be added to objects directly. This script must be inherited from before it may be included on an object. Inheriting from NetworkBehaviour allows access to [network communications](../../../guides/high-level-overview/terminology/communicating.md) and other useful data about the network, server, and client.
Each NetworkBehaviour must be attached to a GameObject that also has a NetworkObject component on it or one of its parent objects.
{% hint style="danger" %}
Adding a NetworkBehaviour derived component at run-time is not yet supported.
{% endhint %}
Please check out the guide page for more information about all the things you can do with NetworkBehaviours:
<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="1f4d8">📘</span> <mark style="color:blue;">NetworkBehaviour Guide</mark></td><td><a href="../../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md">network-behaviour-guides.md</a></td></tr><tr><td align="center">🔌 <mark style="color:yellow;">NetworkBehaviour API</mark></td><td><a href="https://fish-networking.com/FishNet/api/api/FishNet.Object.NetworkBehaviour.html">https://fish-networking.com/FishNet/api/api/FishNet.Object.NetworkBehaviour.html</a></td></tr></tbody></table>
@@ -0,0 +1,21 @@
---
description: >-
The TickNetworkBehaviour subscribes to tick events making them available as
virtual methods.
---
# TickNetworkBehaviour
## Description
This abstract class makes it easy to use the various tick events with simple overrides.
You can change the active event subscriptions through the inspector or through code with the `SetTickCallbacks` method.
## Settings
<figure><img src="../../../.gitbook/assets/ticknetworkbehaviour-editor.png" alt=""><figcaption></figcaption></figure>
### :gear: **Tick Callbacks**
> The Tick Callbacks field lets you choose which timing events the component automatically subscribes to.
@@ -0,0 +1,91 @@
---
description: >-
This component is attached automatically anytime a script which inherits from
NetworkBehaviour is added to your object.
---
# NetworkObject
## Description
The **NetworkObject** component is essential for any game object that needs to be synchronized or controlled over the network using FishNet. It acts as the anchor for all [networked behaviors](../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md) and manages [identification](../../guides/features/server-and-client-identification/), [ownership](../../guides/features/ownership/), and the object's lifecycle within the networking system.
You can nest network objects, place them in scenes, or in prefabs, but the component itself cannot be added to a game object at run-time.
{% hint style="success" %}
Check out the API page for more specific methods, properties, and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Object.NetworkObject.html).
{% endhint %}
## Settings
{% tabs %}
{% tab title="Settings" %}
<div align="left" data-full-width="false"><figure><img src="../../.gitbook/assets/network-object-component.png" alt=""><figcaption><p>Default settings in the <strong>Settings</strong> tab</p></figcaption></figure></div>
:gear: **Is Networked**
> Indicates if an object should always be considered a networked object. When false the object will not initialize as networked. This may be useful if you have objects that you sometimes want to only run locally, and other times spawn over the network. Anytime an object is spawned using [ServerManager.Spawn](../../guides/features/networked-gameobjects-and-scripts/spawning/) _Is Networked_ automatically becomes true for that instantiated copy.
:gear: **Is Spawnable**
> This should be enabled if the object can spawn at runtime; this is generally false for scene prefabs as you do not need to instantiate and manually spawn them. While true, this object's prefab will be added to [DefaultPrefabObjects](../scriptableobjects/spawnableprefabs/defaultprefabobjects.md).
:gear: **Is Global**
> When enabled, this will make the **NetworkObject** known to all clients at all times, the object will also be added to the [Don't Destroy on Load](https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html) scene. This setting will have **no** effect on [scene objects](../../guides/high-level-overview/terminology/miscellaneous.md#scene-object), but for instantiated objects it may be set in the prefab or changed at run-time immediately after instantiating the object.
:gear: **Initialize Order**
> Determines the order in which **NetworkObjects** spawned in the same tick will run their [initialization callbacks](../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md#callbacks). A lower value will have higher priority and execute first. The default value is 0 and negative values are allowed. On the server or clientHost, this value is not used and initialization order dependent upon the order Spawn is called.
:gear: **Prevent Despawn On Disconnect**
> This will ensure the object will not be destroyed or despawned when the owning client disconnects.
:gear: **Default Despawn Type**
> This is the default behavior when despawning the object. Objects are typically destroyed when despawned, but this can be set to other values, such as _Pool_, to save performance.
>
> Check out the [object-pooling.md](../../guides/features/networked-gameobjects-and-scripts/spawning/object-pooling.md "mention")guide for more information.
:gear: **Use Level of Detail**
> This can enable the use of [Level of Detail](../../guides/features/level-of-detail.md) on this NetworkObject. The LOD system must be enabled on the [ObserverManager](managers/observermanager/) for this to work.
{% endtab %}
{% tab title="Prediction" %}
<div align="left"><figure><img src="../../.gitbook/assets/network-object-prediction-component.png" alt=""><figcaption><p>Default settings in the <strong>Prediction</strong> tab</p></figcaption></figure></div>
:gear: **Enable Prediction**
> This should be used to set whether the object is making use of [prediction](../../guides/features/prediction/what-is-client-side-prediction.md) or not. Enabling this will make available the following settings:
:gear: **Prediction Type**
> You can use this to set if you are using rigidbodies or not for the predicted object. For example, if you were updating your transform with a CharacterController component this would be set to _Other_. If you were using rigidbodies you would choose _Rigidbody_ or _Rigidbody2D_.
:gear: **Enable State Forwarding**
> This is used to forward the replicate and reconcile states to all clients. This is ideal for games where you want all clients and server to run the same inputs. Disabling this setting will cause prediction to only be used on the owner; you will then have to synchronize to spectators using other means, such as a [NetworkTransform](network-transform.md) or custom script.
:gear: **Graphical Object**
> This is the object which holds the graphics for your predicted object. When using client-side prediction all predicted objects must have their graphics as a child of the predicted object. For example, if your rigidbody and collider are on the root object, the graphics must remain beneath the root and set as the graphical object.
:gear: **Detach Graphical Object**
> When **true**, this will detach and re-attach the graphical object at runtime when the client initializes/de-initializes the item. This can resolve camera jitter or be helpful objects child of the graphical which do not handle reconiliation well, such as certain animation rigs. Transform is detached after [OnStartClient](../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md#onstartclient), and reattached before [OnStopClient](../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md#onstopclient).
:gear: **Interpolation**
> Is how many ticks to interpolate the graphics on client owned objects. A setting as low as 1 can usually be sufficient to smooth over the frames between ticks.
:gear: **Enable Teleport**
> This will allow the graphical object to teleport to it's actual position – also known as the root position – if the position changes are drastic. Ideally you will not need this setting, but it's an available option should you desire to use it.
:gear: **Teleport Threshold**
> This is shown while teleporting is enabled. If the graphical object's position is this many units away from the actual position, then the graphical object will teleport to the actual position.
{% endtab %}
{% endtabs %}
@@ -0,0 +1,45 @@
---
description: >-
This component lets you override the default observer conditions for a
specific network object.
---
# NetworkObserver
## Description <a href="#conditions" id="conditions"></a>
The **NetworkObserver** uses conditions to determine if a client qualifies to be an observer of an object; any number of conditions may be used and a client will be considered an observer of the object if he passes all active conditions. The NetworkObserver component can be used to override the [ObserverManager](managers/observermanager/), or add additional conditions onto the object to which the NetworkObserver is added.
{% hint style="warning" %}
When adding this component manually, be careful not to unintentionally override the default scene observer condition of the object by using the **Ignore Manager** override type setting.
{% endhint %}
This component will be added to a network object at run-time if it doesn't already exist.
{% hint style="success" %}
Check out the API page for specific methods, and properties [here](https://fish-networking.com/FishNet/api/api/FishNet.Observing.NetworkObserver.html).
{% endhint %}
## Conditions <a href="#conditions" id="conditions"></a>
There are [several included conditions](../scriptableobjects/observerconditions/), which may be used together. ObserverCondition may also be inherited from [to make your own conditions](../../guides/features/observers/custom-conditions.md). When all conditions are true, the object will become visible to the client.
Each condition must be created as a scriptable object, and dropped into the Network Observer component.
## Settings <a href="#component-settings" id="component-settings"></a>
<div align="left"><figure><img src="../../.gitbook/assets/network-observer-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Override Type**
> This is used to change how the **NetworkObserver** component uses the [ObserverManager](managers/observermanager/) settings. _Add Missing_ will add any conditions from the ObserverManager which are not already on the NetworkObserver. _UseManager_ replaces conditions with those from the manager. _Ignore Manager_ will keep the NetworkObserver conditions, ignoring the ObserverManager entirely.
>
> _Add Missing_ is usually the recommended option.
### :gear: **Update Host Visibility**
> This will change the visibility of renderers for the host client when server objects are not visible to the client. If you wish to enable and disable other aspects during a visibility change consider using the [`NetworkObject.OnHostVisibilityUpdated`](https://fish-networking.com/FishNet/api/api/FishNet.Object.NetworkObject.html#FishNet_Object_NetworkObject_OnHostVisibilityUpdated) event.
### :gear: **Observer Conditions**
> This is a list of which observer conditions to use. You can find out more about the specific ones here: [observerconditions](../scriptableobjects/observerconditions/ "mention")
@@ -0,0 +1,63 @@
---
description: The NetworkTransform synchronizes transform properties across the network.
---
# NetworkTransform
## Description <a href="#server-and-host" id="server-and-host"></a>
NetworkTransform is FishNet’s robust solution for syncing transform data (position, rotation, scale) over the network, supporting both server and client authority, smooth movement, and scene hierarchy handling. It is essential for multiplayer games where objects need to appear at the same place for all players.
You may place as many NetworkTransforms as you like on children. A single NetworkTransform will synchronize the object it is directly on.
{% hint style="info" %}
Check out the [moving-your-player-around.md](../../tutorials/getting-started/moving-your-player-around.md "mention") guide for an example of using the **Network Transform** to sync basic player movement.
{% endhint %}
{% hint style="success" %}
Check out the API page for more specific methods, properties, and events [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Transforming.NetworkTransform.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../.gitbook/assets/network-transform-expanded-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Component Configuration**
> The **Component Configuration** attempts to automatically configure components used to move your object. For example, if you were to use a CharacterController you could change this setting to **CharacterController** and the CharacterController will be automatically configured based on other **NetworkTransform** settings. This feature does not change owner smoothing; for example, if you are using a client authoritative rigidbody setting the Component Configuration to rigidbody will not interpolate the rigidbody for owner, but rather configures the rigidbody on non-owners and server so the NetworkTransform can smooth it properly.
### :gear: **Synchronize Parents**
> When enabled, this will automatically synchronize which objects the transform is attached to.
### :gear: **Packing**
> These settings determine the level of packing for each transform property. In some instances you may want more precision; **Unpacked** will give you the most precisio&#x6E;**, Packed** will give you the least amount of precision, and **Packed Less** will give you an in-between amount. Less packing equals more precision at the cost of more network bandwidth used.
### :gear: Interpolation
> This is how long of a buffer to create when replicating the transform. Larger interpolation values will reduce the chance of jitter should there be network lag in favor of the transform being further in the past.
### :gear: **Extrapolation (pro feature)**
> This is how long the transform will try to predict movement when new data is expected, but does not arrive. Using a low interpolation value mixed with extrapolation is a great way to get responsive movement without showing network latency.
### :gear: **Enable Teleport**
> This option allows the **NetworkTransform** to teleport the object instead of smoothly moving it over several frames once the distance moved in an instance is greater than the set threshold.
### :gear: **Teleport Threshold**
> This is how far the transform must travel in a single update to cause a teleport rather than smoothing. Using a value of 0f will teleport every frame and will result in no smoothing at all.
### :gear: **Client Authoritative**
> as true allows the owning client to make changes to their transform locally, and those changes will be sent to the server and other clients. While false the server must change transforms to have them sent to clients.
### :gear: **Send Interval**
> determines at most how often in ticks the NetworkTransform may send. A value of 1 indicates the NetworkTransform can send every tick, if there is change. A value of 5 would mean that the NetworkTransform will send at most every 5 ticks, even if there is change between each tick. For example: if using an interval of 5 and the transform changes and sends on tick 100, then changes on 101, the next update will not send until 105.
### :gear: **Synchronize Position, Rotation, Scale**
> The **Synchronize** settings let you choose which properties to synchronize. Only changed values will send over the network, but if you do not want a value to update at all you can turn off synchronization for a transform property. The **Snapping** settings will allow the transform to snap axes rather than smooth them over time. This feature is commonly used for 2D games, such if you wanted to flip the Y axis on rotation immediately.
@@ -0,0 +1,77 @@
---
description: The NetworkAnimator component synchronizes animations across the network.
---
# NetworkAnimator
## Description
FishNet's **Network Animator** is a component designed to synchronize Unity’s Animator state and parameters over the network. It supports both server-authoritative and client-authoritative modes. In client authority mode, the owner client can send animation parameter changes to the server, which then relays them to other clients.
{% hint style="info" %}
This component does not align with our Client-Side prediction API. You may still use the NetworkAnimator with prediction but the animations likely be updated slightly before the prediction state runs.
{% endhint %}
You may place as many NetworkAnimators as you like on children or root. When an animator is not specified on the Animator field the first one on the same object is used.
{% hint style="success" %}
Check out the API page for specific methods, and properties [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Animating.NetworkAnimator.html).
{% endhint %}
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../.gitbook/assets/network-animator-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Animator**
> This field indicates which Animator to synchronize over the network. The referenced animator can be anywhere on the object. You may also change the Animator at runtime using Network Animator API.
### :gear: **Synchronize When Disabled**
> When enabled, this will allow the **NetworkAnimator** to synchronize changes even when the **Animator** component is disabled.
### :gear: **Interpolation**
> This is how many ticks of interpolation to use. Like the [NetworkTransform](network-transform.md), the animator will be this number of ticks behind before iterating data. To use tick alignment with a NetworkTransform, use the same value of interpolation as on the NetworkTransform.
### :gear: **Smooth Floats**
> This will ensure floats are moved over time on those receiving animator updates. This is commonly left true to allow blending between animation trees.
### :gear: **Client Authoritative**
> When this is enabled it allows the owning client to make changes to their animations locally, and those changes will be sent to the server and other clients. While disabled the server must change animations to have them sent to clients.
### :gear: **Send To Owner**
> This will only be displayed when _**Client Authoritative**_ is false. While _**Synchronize To Owner**_ is true the server will also send animation changes to the object owner; while false the owner will not get the animation changes by the server. This can be useful if you want to run animations locally in real time on owning clients.
### :gear: **Synchronized Parameters (pro feature)**
> These allow only specified parameters to be synchronized over the network. This can be useful if some parameters should only be used for the local client, or do not necessarily need to be networked.
## Runtime
The NetworkAnimator will detect values, layer weights, and speed changes automatically, and synchronize these changes efficiently.
However, most projects also depend on using crossfade, play, and other common Animator APIs.
To synchronize these actions over the network you will simply call each desired method on your NetworkAnimator reference.
```csharp
// This will perform Play on your animator, and synchronize the
// action over the network.
_myNetworkAnimator.Play(stringOrHash);
```
There are several more common methods in our NetworkAnimator component that you will want to use. To see all methods you're encouraged to view our [API](https://fish-networking.com/FishNet/api/api/FishNet.Component.Animating.NetworkAnimator.html) or simply open the NetworkAnimator source file.
Here are some examples of commonly used methods.
```csharp
_myNetworkAnimator.SetTriger(...)
_myNetworkAnimator.ResetTriger(...)
_myNetworkAnimator.CrossFade(...)
```
Other less commonly used actions are **SetController** and **SetAnimator.** You are encouraged to review the API on these when using, or even the XML when calling the method.
@@ -0,0 +1,31 @@
---
description: >-
The Player Spawner component can be used to spawn a game object for a client
once they connect to the game.
---
# 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="../../.gitbook/assets/player-spawner-component.png" 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](../../guides/features/scene-management/). 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.
@@ -0,0 +1,17 @@
---
description: >-
Prediction components are for use with FishNet's prediction systems. Learn
more about each of them here!
---
# Prediction
There are a number of components specifically used for prediction. These include components specifically tied to the [Client-Side Prediction system](#user-content-fn-1)[^1] as well as ones that [are not](#user-content-fn-2)[^2]. Other components such as the NetworkObject can also have settings related to prediction, but they are not included in this subsection.
{% hint style="info" %}
Also consider viewing the [PredictionManager](../managers/predictionmanager.md) to customize global prediction settings.
{% endhint %}
[^1]: For example the NetworkColliders
[^2]: For example the Predicted Spawn and Predicted Owner
@@ -0,0 +1,17 @@
---
description: >-
The NetworkCollider components are a simple way to use Trigger and Collision
callbacks with prediction.
---
# Network Collider
Each component offers callbacks for OnEnter, OnStay, and OnExit, which work even during the prediction cycle. These components are needed because of a limitation in Unity's physics system that affects their OnCollisionEnter and OnCollisionExit methods, causing them to not always be executed.
{% hint style="success" %}
Fun fact: Fish-Networking is the only framework which provides a solution for using Enter/Exit collider callbacks with prediction!
{% endhint %}
{% hint style="warning" %}
Due to the complexity of physics with prediction we currently only support these components on primitive shapes: box, cube, sphere, circle, etc.
{% endhint %}
@@ -0,0 +1,29 @@
---
description: NetworkCollision is used to execute collision events for use with prediction.
---
# NetworkCollision
## Description
This component is used for receiving collision events for prediction enabled objects. It is very much equivalent to a Collider's `OnCollisionEnter`, `OnCollisionExit`, and `OnCollisionStay` messages, except that to receive these you would add this component to your game object and subscribe to its public events.
{% hint style="success" %}
Check out this API page [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Prediction.NetworkCollider.html) for the specific details.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/network-collision-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Maximum Simultaneous Hits**
> This is the maximum number of simultaneous hits that the component will check for. You can use this field to customize how many overlapping colliders the component should be able to detect. It should be noted that having too large of a value will decrease its performance. In most cases, the default value of 16 suffices.
### :gear: **Additional Size**
> The **Additional Size** determines the distance in units by which collision traces are extended. This extension helps prevent missed overlaps when colliders do not intersect sufficiently. Depending on the scale used in your game you may want to raise or lower this value.
### :gear: **Layers**
> These are the Layers to detect collisions on. This is used when value is not set as **Nothing**.
@@ -0,0 +1,35 @@
---
description: >-
NetworkCollision2D is used to execute collision2D events for use with
prediction.
---
# NetworkCollision2D
## Description
This component is used for receiving collision events for prediction enabled objects for 2D Colliders. It is very much equivalent to a Collider's `OnCollisionEnter`, `OnCollisionExit`, and `OnCollisionStay` messages, except that to receive these you would add this component to your game object and subscribe to its public events.
{% hint style="success" %}
Check out this API page [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Prediction.NetworkCollider2D.html) for the specific details.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/network-collision-2d-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Maximum Simultaneous Hits**
> This is the maximum number of simultaneous hits that the component will check for. You can use this field to customize how many overlapping colliders the component should be able to detect. It should be noted that having too large of a value will decrease its performance. In most cases, the default value of 16 suffices.
### :gear: **History Duration**
> This determines how long collision history is retained. Lower values optimize memory usage slightly, but may lead to the collision records becoming out of sync on clients with excessively high latency.
### :gear: **Additional Size**
> The **Additional Size** determines the distance in units by which collision traces are extended. This extension helps prevent missed overlaps when colliders do not intersect sufficiently. Depending on the scale used in your game you may want to raise or lower this value.
### :gear: **Layers**
> These are the Layers to detect collisions on. This is used when value is not set as **Nothing**.
@@ -0,0 +1,29 @@
---
description: NetworkTrigger is used to execute trigger events for use with prediction.
---
# NetworkTrigger
## Description
This component is used for receiving trigger events for prediction enabled objects for 2D Colliders. It is very much equivalent to a Collider's `OnTriggerEnter`, `OnTriggerExit`, and `OnTriggerStay` messages, except that to receive these you would add this component to your game object and subscribe to its public events.
{% hint style="success" %}
Check out this API page [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Prediction.NetworkCollider.html) for the specific details.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/network-trigger-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Maximum Simultaneous Hits**
> This is the maximum number of simultaneous hits that the component will check for. You can use this field to customize how many overlapping colliders the component should be able to detect. It should be noted that having too large of a value will decrease its performance. In most cases, the default value of 16 suffices.
### :gear: **Additional Size**
> The **Additional Size** determines the distance in units by which collision traces are extended. This extension helps prevent missed overlaps when colliders do not intersect sufficiently. Depending on the scale used in your game you may want to raise or lower this value.
### :gear: **Layers**
> These are the Layers to detect collisions on. This is used when value is not set as **Nothing**.
@@ -0,0 +1,33 @@
---
description: NetworkTrigger2D is used to execute trigger2D events for use with prediction.
---
# NetworkTrigger2D
## Description
This component is used for receiving trigger events for prediction enabled objects for 2D Colliders. It is very much equivalent to a Collider's `OnTriggerEnter`, `OnTriggerExit`, and `OnTriggerStay` messages, except that to receive these you would add this component to your game object and subscribe to its public events.
{% hint style="success" %}
Check out this API page [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Prediction.NetworkCollider2D.html) for the specific details.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../../.gitbook/assets/network-trigger-2d-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Maximum Simultaneous Hits**
> This is the maximum number of simultaneous hits that the component will check for. You can use this field to customize how many overlapping colliders the component should be able to detect. It should be noted that having too large of a value will decrease its performance. In most cases, the default value of 16 suffices.
### :gear: **History Duration**
> This determines how long collision history is retained. Lower values optimize memory usage slightly, but may lead to the collision records becoming out of sync on clients with excessively high latency.
### :gear: **Additional Size**
> The **Additional Size** determines the distance in units by which collision traces are extended. This extension helps prevent missed overlaps when colliders do not intersect sufficiently. Depending on the scale used in your game you may want to raise or lower this value.
### :gear: **Layers**
> These are the Layers to detect collisions on. This is used when value is not set as **Nothing**.
@@ -0,0 +1,27 @@
---
description: >-
This component can be used to prevent client side objects from running physics
too quickly due to prediction replays.
---
# OfflineRigidbody
## Description
When using predictions, especially physics prediction, the client will often re-simulate physics to make corrections. You generally want to add an OfflineRigidbody component to prevent non-networked objects from simulating multiple times during a correction.
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/offline-rigidbody-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Rigidbody Type**
> This is to specify if the offline object uses a rigidbody3d, or 2d.
### :gear: **Get In Children**
> This setting should be enabled if you have child rigidbodies. Keeping this disabled when child rigidbodies are not present will save a very small amount of performance.
## Combining Smoothers
There is a fair chance you will want to have the graphical object on your rigidbodies smoothed between ticks. There are a variety of components to accomplish this; see them on the [tick-smoothers](../tick-smoothers/ "mention") page.
@@ -0,0 +1,26 @@
---
description: >-
The PredictedOwner component allows a user to claim ownership of an object
immediately and be able to use it before the server officially gives the
ownership over.
---
# PredictedOwner
## Description
The **PredictedOwner** allows clients to immediately simulate ownership on an object without waiting for the server's response. This overcomes delays from client latency, allowing for a seamless transition of ownership. Placing this component on an object enables this feature for that network object.
A client can use the [`TakeOwnership`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedOwner.html#FishNet_Component_Ownership_PredictedOwner_TakeOwnership_System_Boolean_) method to anticipatorily claim ownership of an object. You can also access the [`PreviousOwner`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedOwner.html#FishNet_Component_Ownership_PredictedOwner_PreviousOwner) of the object and by inheriting from this component you can add checks to the server to decide whether to accept the ownership change or reject it. This can be done by overriding the [`OnTakeOwnership`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedOwner.html#FishNet_Component_Ownership_PredictedOwner_OnTakeOwnership_FishNet_Connection_NetworkConnection_System_Boolean_) method and not handing over the ownership for whatever reason you may have.
{% hint style="success" %}
Check out its full API page for more specific methods and properties [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedOwner.html).
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/predicted-owner-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Allow Take Ownership**
> This enables or disables the functionality of this component, and can be set at run-time from the server with this method: [`SetAllowTakeOwnership`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Ownership.PredictedOwner.html#FishNet_Component_Ownership_PredictedOwner_SetAllowTakeOwnership_System_Boolean_).
@@ -0,0 +1,35 @@
---
description: >-
The PredictedSpawn component allows you to spawn this Network Object directly
on the client side.
---
# PredictedSpawn
## Description
Adding this component to a [NetworkObject](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) will allow you to adjust [predicted spawning](../../../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](../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="../../../.gitbook/assets/predicted-spawn-component.png" 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.md](../../../guides/features/networked-gameobjects-and-scripts/spawning/spawn-payloads.md "mention")
{% endhint %}
@@ -0,0 +1,27 @@
---
description: >-
An easy tool to assist with spawning specific objects as soon as the server
starts.
---
# ServerSpawner
## Description <a href="#server-and-host" id="server-and-host"></a>
The **ServerSpawner** component is a helpful tool that you can use for optionally instantiating and spawning objects as soon as the FishNet server successfully starts running (or on your own command if preferred). This is very often used to instantiate [Global Network Objects](#user-content-fn-1)[^1], which need to be instantiated at run-time instead of existing inside a scene directly.
## Settings <a href="#server-and-host" id="server-and-host"></a>
<div align="left"><figure><img src="../../.gitbook/assets/server-spawner-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Automatically Spawn**
> This dictates whether the component will instantiate and spawn the objects as soon as the server starts, or only after you manually call `Spawn` on the **ServerSpawner** component.
>
> You can disable this if you want to manually control when these objects are spawned.
### :gear: **Network Objects**
> This is a list of the Network Objects the component will instantiate once the server starts. The order of this list is respected when instantiating the objects, and the component will attempt to use [FishNet's object pooling](../../guides/features/networked-gameobjects-and-scripts/spawning/object-pooling.md) for the objects if they are added to the an object pool.
[^1]: These are NetworkObjects that are added to the DontDestroyOnLoad scene and visible to all clients.
@@ -0,0 +1,16 @@
---
description: >-
These components smooths a child graphical object over frames between each
network tick. These are useful for prediction and smoothing graphics on larger
physics steps.
---
# Tick Smoothers
You may put multiple tick smoother components beneath an object if you have several different graphical pieces in your hierarchy you want smoothed. A good example of this is a vehicle where the wheels move independently of the vehicle body.
The smoother will be placed on the graphical object you wish to smooth; this object must not be the same as the target, nor higher in the hierarchy of the target; being a child of the target is fine.
{% hint style="success" %}
Tick Smoothers are only used by clients. These components will not function when only the server is started.
{% endhint %}
@@ -0,0 +1,8 @@
---
description: >-
This component is primarily used for smooth camera movement between ticks. It
can be used with prediction or normal design.
---
# DetachableNetworkTickSmoother \[Obsolete]
@@ -0,0 +1,8 @@
---
description: >-
MonoTickSmoother smooths a child graphical object over frames between each
network tick. This component can be used on non-networked objects.
---
# MonoTickSmoother \[Obsolete]
@@ -0,0 +1,65 @@
---
description: >-
The Network Tick Smoother component ensures smooth and visually consistent
movement of networked objects by interpolating their positions, rotations, and
scale between network updates.
---
# NetworkTickSmoother
## Description
The **Network Tick Smoother** is responsible for smoothing an object's transformation properties between network ticks. Its main purpose is to make movement, rotation, and scale, transitions appear fluid, even though network updates may arrive in discrete steps. The **NetworkTickSmoother** initializes its settings using [NetworkBehaviour callbacks](../../../guides/features/networked-gameobjects-and-scripts/network-behaviour-guides.md#callbacks), and may only be placed below a [NetworkObject](../network-object.md); if you need this form of smoothing for objects that aren't NetworkObjects you can use the [offlineticksmoother.md](offlineticksmoother.md "mention") instead.
There are several public APIs available for changing the smoother settings at runtime. An example of some are changing adaptive interpolation type, interpolation value, teleporting the smoothed object, and more.
{% hint style="success" %}
Please review our [API ](https://fish-networking.com/FishNet/api/api/FishNet.Component.Transforming.NetworkTickSmoother.html)for all runtime settings.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/network-tick-smoother-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: Initialization Settings
> These are essential to the component working.
>
> * **Target Transform** is the transform you want to follow. This is commonly the root NetworkObject but may be other nested NetworkBehaviours when using multiple smoothers beneath a single NetworkObject.
> * **Detach On Start** when true will unparent the object which the smoother is attached, placing it as root in world space. Detach is commonly used when the smoothed object is a camera target, given cameras do not handle rollback or larger tick steps well.
> * **Attach On Stop** when true will reparent the graphical object when the network stop callbacks occur on the object, as detach will unparent on network start callbacks. Typically you want to reattach graphical objects. If the Target Transform is destroyed while detached the object the smoother is attached to will also destroy itself.
### :gear: **Controller**
> The **Controller** settings determine how the object is smoothed for the controller of the object, which is either the owner or if the object has no owner then it is the server.
>
> * **Enable Teleport** will allow the graphical object to teleport to it's actual position – also known as the root position – if the position changes are drastic. Ideally you will not need this setting, but it's an available option should you desire to use it.
> * **Teleport Threshold** is shown while teleporting is enabled. If the graphical object's position is this many units away from the actual position, then the graphical object will teleport to the actual position.
> * **Adaptive Interpolation,** when not disabled, will increase the interpolation amount as the local client's latency becomes higher. Low settings of adaptive interpolation will increase the interpolation at lower amounts, while high will increases the interpolation more. When Adaptive Interpolation is disabled, a flat amount of interpolation will used at all times.\
> \
> Flat interpolation is often used in competitive or reaction based games to keep the interpolation consistent for all players. Flat interpolation is also necessary for accurate collider rollback, given our [collider rollback system](../../../guides/features/lag-compensation/) needs to know the amount of interpolation a client sees to provide accurate raycast hit results.\
> \
> Adaptive interpolation is best used with casual games where you want the absolute smoothed experiences regardless of local client latency.
> * **Interpolation Value** is displayed when Adaptive Interpolation is off. This is a flat amount of interpolation that does not increase when the local client's latency does.
> * **Smoothed Properties** determines which properties of the transform will be smoothed. If smoothing is not set for a specific property, then that particular value will persist in the same world space at all times. For example, if you uncheck Position from Smoothed Properties and move the root, the object which this component sits will never move in space, unless you of course move it manually.
### :gear: Spectator Smoothing
> The **Spectator Smoothing** settings determine how the object is smoothed for client's that are **not** the owner.
>
> * **Favor Prediction Network Transform** prevents jitter by automatically disabling the NetworkTickSmoother when a predicted NetworkObject is under the active control of a NetworkTransform. If a specific transform is assigned in the prediction field, the smoother will yield control to the NetworkTransform’s internal smoothing logic; otherwise, the smoother remains active to handle state interpolation.
> * **Enable Teleport** will allow the graphical object to teleport to it's actual position – also known as the root position – if the position changes are drastic. Ideally you will not need this setting, but it's an available option should you desire to use it.
> * **Teleport Threshold** is shown while teleporting is enabled. If the graphical object's position is this many units away from the actual position, then the graphical object will teleport to the actual position.
> * **Adaptive Interpolation,** when not disabled, will increase the interpolation amount as the local client's latency becomes higher. Low settings of adaptive interpolation will increase the interpolation at lower amounts, while high will increases the interpolation more. When Adaptive Interpolation is disabled, a flat amount of interpolation will used at all times.\
> \
> Flat interpolation is often used in competitive or reaction based games to keep the interpolation consistent for all players. Flat interpolation is also necessary for accurate collider rollback, given our [collider rollback system](../../../guides/features/lag-compensation/) needs to know the amount of interpolation a client sees to provide accurate raycast hit results.\
> \
> Adaptive interpolation is best used with casual games where you want the absolute smoothed experiences regardless of local client latency.
> * **Interpolation Value** is displayed when Adaptive Interpolation is off. This is a flat amount of interpolation that does not increase when the local client's latency does.
> * **Smoothed Properties** determines which properties of the transform will be smoothed. If smoothing is not set for a specific property then that particular value will persist in the same world space at all times. For example, if you uncheck Position from Smoothed Properties and move the root, the object which this component sits will never move in space, unless you of course move it manually.
## Scale Smoothing
Scale behaves a little differently when smoothed. Since nested objects use a localScale they will not change with the parent scale, and thus cannot be easily interpolated.
If you wish to smooth scale transitions then **Detach** (and optionally **Reattach**) must be enabled in the initialization settings so that the smoothed object does not have it's global (lossy) scale modified by Unity when the target transform or any higher transform has it's scale changed.
@@ -0,0 +1,52 @@
---
description: >-
The Offline Tick Smoother component ensures smooth and visually consistent
movement of non-networked objects by interpolating their positions, rotations,
and scale between network updates.
---
# OfflineTickSmoother
## Description
The OfflineTickSmoother behaves just like the [networkticksmoother.md](networkticksmoother.md "mention"), except it initializes it's settings using the [InstanceFinder](../../../guides/features/instancefinder-guides.md) and can thus be placed beneath objects which are not networked. It is responsible for smoothing an offline object's transformation properties between network ticks.
There are several public APIs available for changing the smoother settings at runtime. An example of some are changing adaptive interpolation type, interpolation value, teleporting the smoothed object, and more.
{% hint style="success" %}
Please review our [API ](https://fish-networking.com/FishNet/api/api/FishNet.Component.Transforming.NetworkTickSmoother.html)for all runtime settings.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/offline-tick-smoother-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Automatically Initialize**
> This option will configure this smoother in Awake using the [InstanceFinder](../../../guides/features/instancefinder-guides.md) to listen to network callbacks. When false, you must manually call the `Initialize` method on this component.
### :gear: Initialization Settings
> These are essential to the component working.
>
> * **Target Transform** is the transform you want to follow. This is commonly the root [NetworkObject](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) but may be other nested NetworkBehaviours when using multiple smoothers beneath a single NetworkObject.
> * **Detach On Start** when true will unparent the object which the smoother is attached, placing it as root in world space. Detach is commonly used when the smoothed object is a camera target, given cameras do not handle rollback or larger tick steps well.
> * **Attach On Stop** when true will reparent the graphical object when the network stop callbacks occur on the object, as detach will unparent on network start callbacks. Typically you want to reattach graphical objects. If the Target Transform is destroyed while detached the object the smoother is attached to will also destroy itself.
### :gear: Smoothing
> The **Smoothing** settings determine how the object is smoothed.
>
> * **Enable Teleport** will allow the graphical object to teleport to it's actual position – also known as the root position – if the position changes are drastic. Ideally you will not need this setting, but it's an available option should you desire to use it.
> * **Teleport Threshold** is shown while teleporting is enabled. If the graphical object's position is this many units away from the actual position, then the graphical object will teleport to the actual position.
> * **Adaptive Interpolation,** when not disabled, will increase the interpolation amount as the local client's latency becomes higher. Low settings of adaptive interpolation will increase the interpolation at lower amounts, while high will increases the interpolation more. When Adaptive Interpolation is disabled, a flat amount of interpolation will used at all times.\
> \
> Flat interpolation is often used in competitive or reaction based games to keep the interpolation consistent for all players. Flat interpolation is also necessary for accurate collider rollback, given our [collider rollback system](../../../guides/features/lag-compensation/) needs to know the amount of interpolation a client sees to provide accurate raycast hit results.\
> \
> Adaptive interpolation is best used with casual games where you want the absolute smoothed experiences regardless of local client latency.
> * **Interpolation Value** is displayed when Adaptive Interpolation is off. This is a flat amount of interpolation that does not increase when the local client's latency does.
> * **Smoothed Properties** determines which properties of the transform will be smoothed. If smoothing is not set for a specific property then that particular value will persist in the same world space at all times. For example, if you uncheck Position from Smoothed Properties and move the root, the object which this component sits will never move in space, unless you of course move it manually.
{% hint style="info" %}
Since a non-networked object cannot be owned there is only one set of smoothing settings, compared to NetworkTickSmoother which can have unique settings if Owner or Spectator.
{% endhint %}
@@ -0,0 +1,8 @@
---
description: >-
There are multiple commonly needed helper or debugging components that come
with Fish-Networking.
---
# Utilities
@@ -0,0 +1,9 @@
---
description: >-
Authenticators are an additional layer of security. A client must pass the
authenticator in order to communicate with the game server.
---
# Authenticator
Authenticator logic can be fully customized by inheriting from the _**Authenticator**_ script, and placing your created authenticator within the [Server Manager component](../managers/server-manager.md). There are a few example authenticators that come installed with the FishNet package within the `FishNet/Demos/Authenticator/Scripts` directory.
@@ -0,0 +1,37 @@
---
description: >-
The BandwidthDisplay component is a simple development GUI to show the
bandwidth ingress and egress.
---
# BandwidthDisplay
## Description
Using this component in combination with the [Statistics Manager](../managers/statisticsmanager.md) will show bandwidth being used by Fish-Networking.
<div align="left"><figure><img src="../../../.gitbook/assets/bandwidth-display-example.png" alt="Image showing the current bandwidth being used at the top right of a screen in a game."><figcaption><p>Example of the BandwidthDisplay being used</p></figcaption></figure></div>
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/bandwidth-display-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Color**
> This is which color to display results as.
### :gear: **Placement**
> The **Placement** is in what part of the screen to display results.
### :gear: **Seconds Averaged**
> This is for the number of seconds used to gather data. Lower values will show more up to date usage per second while higher values provide a better over-all estimate.
### :gear: **Show Outgoing**
> When enabled, this will display the bandwidth used from data being sent. This can be changed at runtime with the [`SetShowOutgoing`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Utility.BandwidthDisplay.html#FishNet_Component_Utility_BandwidthDisplay_SetShowOutgoing_System_Boolean_) method.
### :gear: **Show Incoming**
> When enabled, this will display the bandwidth used from data being received. This can be changed at runtime with the [`SetShowIncoming`](https://fish-networking.com/FishNet/api/api/FishNet.Component.Utility.BandwidthDisplay.html#FishNet_Component_Utility_BandwidthDisplay_SetShowIncoming_System_Boolean_) method.
@@ -0,0 +1,43 @@
---
description: >-
This component can be used to easily load an online scene when network starts
and an offline one when it stops.
---
# DefaultScene
## Description
This component will automatically change between online and offline scenes depending on server and client connective state. When a connection is started the online scene is loaded, and when disconnected the offline scene is loaded. This component must be placed on or beneath your [NetworkManager](../managers/network-manager.md).
{% hint style="success" %}
Check out the API page for specific methods [here](https://fish-networking.com/FishNet/api/api/FishNet.Component.Scenes.DefaultScene.html).
{% endhint %}
{% hint style="warning" %}
For this component to work, both the online scene and the offline scene must be selected in the inspector, and they must not be the same scene.
{% endhint %}
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/default-scene-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Enable Global Scenes**
> This will load the scenes as global when enabled, or as connection when not. For more information on the differences see [Scene Loading](../../../guides/features/scene-management/loading-scenes/).
### :gear: **Start In Offline**
> This will load the server and clients into the offline scene when the game starts.
### :gear: **Offline Scene**
> This is the scene to load when offline.
### :gear: **Online Scene**
> This is the scene to load when online.
### :gear: **Replace Scenes**
> This can be set to replace all loaded scenes, or just online scenes with the Online or Offline scene. For more information see loading [Scene Loading - replacing scenes](../../../guides/features/scene-management/loading-scenes/).
@@ -0,0 +1,29 @@
---
description: >-
The PingDisplay can be used to easily display the client's network ping during
development.
---
# PingDisplay
## Description
Often times you may want to display the local client's ping while developing your game, this can easily be done with the **PingDisplay** component. This component is commonly added to the [NetworkManager](../managers/network-manager.md) object, but that is not a requirement.
<div align="left"><figure><img src="../../../.gitbook/assets/ping-display-example.png" alt="An image of a game with a text at the top right showing the client&#x27;s ping"><figcaption><p>Example of the PingDisplay component in-use</p></figcaption></figure></div>
## Settings
<div align="left"><figure><img src="../../../.gitbook/assets/ping-display-component.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
### :gear: **Color**
> This is which color to use for the displayed text.
### :gear: **Placement**
> The P**lacement** indicates in which part of the screen to display the client's ping.
### :gear: **Hide Tick Rate**
> This option will remove tick rate latency from the ping results otherwise the displayed ping will include the delay caused by the server's tick rate.