新增FishNet文档
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Scriptable Objects utilized by FishNet for configuration.
|
||||
---
|
||||
|
||||
# ScriptableObjects
|
||||
|
||||
Fish-Networking includes quite a few [ScriptableObjects ](https://docs.unity3d.com/Manual/class-ScriptableObject.html)that you can use to customize the behavior of specific features. There are default ones included with FishNet, but you can also create your own from the _**Assets → Create → FishNet**_ toolbar menu.
|
||||
|
||||
<figure><img src="../../.gitbook/assets/fishnet-asset-create-menu.png" alt="Image showing FishNet assets creation menu"><figcaption><p>Create FishNet asset menu</p></figcaption></figure>
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
description: >-
|
||||
The scriptable object that allows you to customize what FishNet will output
|
||||
logs of.
|
||||
---
|
||||
|
||||
# LevelLoggingConfiguration
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Level Logging Configuration** scriptable object simply allows you to customize Fish-Networking's logging. Once created, it can be selected on the [NetworkManager](../components/managers/network-manager.md) component. There are four logging levels available for the various build and editor types. **Off** will permit no logs, **Error** will only permit direct error logs, **Warning** will allow error and warning logs, and **Common** will allow all logging, including errors, warnings, and informational logs.
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<figure><img src="../../.gitbook/assets/level-logging-configuration.png" alt=""><figcaption><p>Default settings</p></figcaption></figure>
|
||||
|
||||
### :gear: **Is Enabled**
|
||||
|
||||
> This is simply a toggle to enable and disable all of Fish-Networking's logs.
|
||||
|
||||
### :gear: Add Local Tick
|
||||
|
||||
> This option allows you to prepend the network's local tick when log was made onto the log message. This can be quite handy for precise debugging.
|
||||
|
||||
### :gear: **Add Timestamps**
|
||||
|
||||
> This allows you to prepend to all logs the local date and time when the log was made.
|
||||
|
||||
### :gear: Enable Timestamps In Editor
|
||||
|
||||
> Since Unity's console already includes the time that logs are sent at, it can be handy to hide FishNet's Timestamps in the editor and only display them in builds.
|
||||
|
||||
### :gear: **Development Logging**
|
||||
|
||||
> This controls the level of logs sent while the game is a development build or editor.
|
||||
|
||||
### :gear: **GUI Logging**
|
||||
|
||||
> This controls the level of logging to use when the game is built regularly, as opposed to a headless (non GUI) build.
|
||||
|
||||
### :gear: **Headless Logging**
|
||||
|
||||
> This controls the logging level for headless game builds.
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# ObserverConditions
|
||||
|
||||
**ObserverConditions** in Fish-Networking define specific conditions under which clients receive updates about a [NetworkObject's](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) state. These conditions help optimize network traffic by ensuring that only relevant updates are transmitted, as well as prevent client's from cheating by only sending relevant data to individual clients.
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# DistanceCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Distance Condition** ensures that an object is only observed if it is at least a specified minimum distance away from all objects owned by a client. The Distance Condition is a [Timed Condition](#user-content-fn-1)[^1].
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/distance-observer-condition.svg" alt="" width="563"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/distance-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
### :gear: **Maximum Distance**
|
||||
|
||||
> The maximum distance that any object owned by a client must be within an object to observe it. If all of the client's owned [NetworkObjects](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) are farther than this distance, the object will not be visible to them.
|
||||
|
||||
### :gear: **Hide Distance Percent**
|
||||
|
||||
> **This** determines an additional buffer zone beyond the maximum distance before an object is hidden. The purpose of the "Hide Distance Percent" is to prevent objects from flickering in and out of visibility when a client is near the maximum distance threshold. It creates a smoother transition for hiding objects by adding a percentage-based distance buffer. As an example, if the **Maximum Distance** is set to `100f` and the **Hide Distance Percent** is `0.5` (50%), the object will remain visible until the client is `150f` units away. This ensures objects do not disappear immediately as they cross the initial visibility boundary.
|
||||
|
||||
[^1]: A Timed Condition is evaluated periodically rather than only when certain conditions change.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# GridCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Grid Condition** is similar to the [DistanceCondition](distancecondition.md) and evaluates to true if clients are within specified distance of the object. The Grid Condition is however less accurate but more performant; it is also a [Timed Condition](#user-content-fn-1)[^1]. This condition requires you to place a [HashGrid ](../../components/managers/observermanager/hashgrid.md)on or beneath your [NetworkManager](../../components/managers/network-manager.md) object.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/grid-observer-condition.svg" alt="" width="443"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/grid-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
[^1]: A Timed Condition is evaluated periodically rather than only when certain conditions change.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# HostOnlyCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Host Only Condition** evaluates to true when the player is a client host. Any connection which is not client host will fail this evaluation. You can use this observer condition to only show objects to the host player, either permanently or temporarily. This condition is not a timed condition.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/host-only-observer-condition.svg" alt="" width="419"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/host-only-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# MatchCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Match Condition** evaluates to true when players or objects share the same match[^1]. Both owned and non-owned objects can be added to matches. Objects or players not added to matches will have their data synchronized with everyone, unless prevented by another condition. See the [MatchCondition api](https://fish-networking.com/FishNet/api/api/FishNet.Component.Observing.MatchCondition.html) for more information on usage. This condition is not a timed condition.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/match-observer-condition.svg" alt="" width="466"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left" data-full-width="false"><figure><img src="../../../.gitbook/assets/match-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
[^1]: A _match_ can mean a lot of different things, but in this case it is basically a custom tag you can give objects and players to separate them from observing one another.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# OwnerOnlyCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Owner Only Condition** evaluates to true when a player owns the object. An owner condition will make an object only visible to its owner. If there is no owner, the object will not be visible to any clients. This can be very useful for sharing information with only the owner client, for example inventory data or a player's hand of cards, which shouldn't be shared with other clients to prevent cheating and wasted bandwidth.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/owner-only-observer-condition.svg" alt="" width="469"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/owner-only-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# SceneCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Scene Condition** evaluates to true if the client shares any scenes with the object. This is arguably the most important observer condition, and it is the only one that is added by default to the [example NetworkManager prefab](../../prefabs/networkmanager.md). This condition is important because it helps avoid serious de-syncs that would happen if the server tried to tell clients about objects from a scene they haven't yet loaded.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/scene-observer-condition.svg" alt="" width="457"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/scene-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# SpawnablePrefabs
|
||||
|
||||
Fish-Networking uses a collection of prefabs to manage spawning of network objects across the network. Whenever you instantiate and [spawn](../../../guides/features/networked-gameobjects-and-scripts/spawning/) an object on the server, FishNet will use the selected **Spawnable Prefabs** collection to find which object it is and to automatically instantiate and link the objects on all clients.
|
||||
|
||||
The **Spawnable Prefabs** collection can be set on your [NetworkManager](../../components/managers/network-manager.md) component.
|
||||
|
||||
{% hint style="success" %}
|
||||
The NetworkManager will automatically set the **Spawnable Prefabs** to an automatically managed [DefaultPrefabObjects ](defaultprefabobjects.md)asset if a custom one is not selected.
|
||||
{% endhint %}
|
||||
|
||||
<figure><img src="../../../.gitbook/assets/network-manager-spawnable-prefabs.png" alt="NetworkManager component highlighting Spawnable Prefabs field"><figcaption><p>The <strong>Spawnable Prefabs</strong> field on the NetworkManager</p></figcaption></figure>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
# DefaultPrefabObjects
|
||||
|
||||
The **Default Prefab Objects** asset is a dynamically populated collection of spawnable network objects. FishNet automatically generates it in the designated directory specified in your Fish-Networking configuration, filling it with networked prefabs from the configured locations.
|
||||
|
||||
{% hint style="info" %}
|
||||
You do not need to manually populate or update this collection, FishNet will take care of it automatically.
|
||||
{% endhint %}
|
||||
|
||||
<figure><img src="../../../.gitbook/assets/default-prefab-objects.png" alt=""><figcaption><p>Example of <strong>DefaultPrefabObjects</strong> being populated by Networked Prefabs</p></figcaption></figure>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
# DualPrefabObjects
|
||||
|
||||
The Dual Prefab Objects asset can be used to have Fish-Networking spawn a different prefab on the clients as it uses on the server. Whenever you spawn the server selected version, FishNet will spawn the client version on all clients.
|
||||
|
||||
{% hint style="success" %}
|
||||
You can select the same prefab in both the Server and Client fields to have the same one spawned on all clients as the server.
|
||||
{% endhint %}
|
||||
|
||||
<figure><img src="../../../.gitbook/assets/dual-prefab-objects.png" alt=""><figcaption><p>Example of a <strong>Dual Prefab Objects</strong> asset being populated</p></figcaption></figure>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
# SinglePrefabObjects
|
||||
|
||||
The **Single Prefab Objects** is a scriptable object which you can inherit from for custom functionality. It is used by the DefaultPrefabObjects collection and can also be directly used for your own collections. If using it directly, remember to manually add all your spawnable network object prefabs into its collection.
|
||||
|
||||
<figure><img src="../../../.gitbook/assets/single-spawnable-prefabs.png" alt="screenshot of a single prefab objects asset being filled in"><figcaption><p>A <strong>single prefab objects</strong> asset being manually populated</p></figcaption></figure>
|
||||
Reference in New Issue
Block a user