From 7b39329a2706cba993f23d57eb734cbf0c8ae843 Mon Sep 17 00:00:00 2001 From: "amy.reeve" Date: Fri, 24 Jul 2026 13:18:24 +0100 Subject: [PATCH 1/2] Docs-wide link fixes and xref update --- .../advanced-topics/custom-serialization.md | 2 +- .../fastbufferwriter-fastbufferreader.md | 2 +- .../message-system/rpc-params.md | 4 +-- .../advanced-topics/message-system/rpc.md | 2 +- .../advanced-topics/network-prefab-handler.md | 12 +++---- .../network-update-loop-reference.md | 4 +-- .../networkobject-parenting.md | 6 ++-- .../advanced-topics/networktime-ticks.md | 2 +- .../Documentation~/advanced-topics/physics.md | 2 +- .../serialization/inetworkserializable.md | 4 +-- .../inetworkserializebymemcpy.md | 2 +- .../networkobject-serialization.md | 2 +- .../serialization/serialization-arrays.md | 2 +- .../serialization/serialization-overview.md | 2 +- .../advanced-topics/session-management.md | 2 +- .../advanced-topics/singleplayer.md | 2 +- .../advanced-topics/transports.md | 2 +- .../basics/custom-networkvariables.md | 2 +- .../Documentation~/basics/object-spawning.md | 2 +- .../scenemanagement/custom-management.md | 2 +- .../inscene-placed-networkobjects.md | 2 +- .../basics/scenemanagement/scene-events.md | 2 +- .../using-networkscenemanager.md | 6 ++-- .../components/core/corecomponents.md | 2 +- .../core/networkbehaviour-ownership.md | 18 +++++------ .../core/networkbehaviour-synchronize.md | 4 +-- .../components/core/networkbehaviour.md | 2 +- .../components/core/networkmanager.md | 16 +++++----- .../core/networkobject-ownership.md | 32 +++++++++---------- .../components/core/networkobject.md | 4 +-- .../components/core/playerobjects.md | 4 +-- .../components/helper/componentcontroller.md | 2 +- .../components/helper/helpercomponents.md | 4 +-- .../components/helper/networkrigidbody.md | 4 +-- .../components/helper/networktransform.md | 18 +++++------ .../Documentation~/install.md | 2 +- .../learn/dealing-with-latency.md | 6 ++-- .../learn/listenserverhostarchitecture.md | 2 +- .../Documentation~/learn/rpcvnetvar.md | 2 +- .../learn/ticks-and-update-rates.md | 4 +-- .../Documentation~/migratingfromUNet.md | 4 +-- .../networkbehaviour-landing.md | 2 +- .../Documentation~/removed-tableofcontents.md | 2 +- .../samples/bitesize/bitesize-landing.md | 2 +- .../samples/bitesize/bitesize-usecases.md | 4 +-- .../bossroom/getting-started-boss-room.md | 4 +-- .../samples/bossroom/optimizing-bossroom.md | 8 ++--- .../Documentation~/serialization.md | 2 +- .../terms-concepts/distributed-authority.md | 2 +- .../terms-concepts/ownership.md | 4 +-- .../tutorials/get-started-with-ngo.md | 10 +++--- ..._tricks_for_debugging_multiplayer_games.md | 4 +-- .../testing_with_artificial_conditions.md | 8 ++--- 53 files changed, 126 insertions(+), 126 deletions(-) diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/custom-serialization.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/custom-serialization.md index b7b23e4afc..f1210fbc95 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/custom-serialization.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/custom-serialization.md @@ -68,4 +68,4 @@ Reading and writing a value provides the minimal amount of `NetworkVariable` fun Here is a full implementation of a custom type with the methods needed for `UserNetworkVariableSerialization` -[!code-cs[](../../Tests/Runtime/DocumentationCodeSamples/NetworkVariable/NetworkVariableSerialization.cs#HealthExample)] +[!code-cs[](../../Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs#HealthExample)] diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/fastbufferwriter-fastbufferreader.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/fastbufferwriter-fastbufferreader.md index 3f8327fc17..7b9d5d65c3 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/fastbufferwriter-fastbufferreader.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/fastbufferwriter-fastbufferreader.md @@ -82,7 +82,7 @@ This allows the four bytes of the embedded struct to be rapidly serialized as a `FastBufferWriter` and `FastBufferReader` are replacements for the old `NetworkWriter` and `NetworkReader`. For those familiar with the old classes, there are some key differences: -- `FastBufferWriter` uses `WriteValue()` as the name of the method for all types *except* [`INetworkSerializable`](serialization/inetworkserializable) types, which are serialized through `WriteNetworkSerializable()` +- `FastBufferWriter` uses `WriteValue()` as the name of the method for all types *except* [`INetworkSerializable`](serialization/inetworkserializable.md) types, which are serialized through `WriteNetworkSerializable()` - `FastBufferReader` similarly uses `ReadValue()` for all types except INetworkSerializable (which is read through `ReadNetworkSerializable`), with the output changed from a return value to an `out` parameter to allow for method overload resolution to pick the correct value. - `FastBufferWriter` and `FastBufferReader` outsource packed writes and reads to `BytePacker` and `ByteUnpacker`, respectively. - `FastBufferWriter` and `FastBufferReader` are **structs**, not **classes**. This means they can be constructed and destructed without GC allocations. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc-params.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc-params.md index 28d0607ef3..7c37bd606d 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc-params.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc-params.md @@ -75,7 +75,7 @@ void AbcdServerRpc(int somenumber) { /* ... */ } void XyzwServerRpc(int somenumber, ServerRpcParams serverRpcParams = default) { /* ... */ } ``` -[ServerRpcParams Documentation](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.ServerRpcParams.html) +[ServerRpcParams Documentation](xref:Unity.Netcode.ServerRpcParams) ## ClientRpc Params @@ -94,7 +94,7 @@ void AbcdClientRpc(int framekey) { /* ... */ } void XyzwClientRpc(int framekey, ClientRpcParams clientRpcParams = default) { /* ... */ } ``` -[ClientRpcParams Documentation](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.ClientRpcParams.html) +[ClientRpcParams Documentation](xref:Unity.Netcode.ClientRpcParams) > [!NOTE] > `ClientRpcSendParams`'s `TargetClientIds` property is a `ulong[]` which means everytime you try to specify a subset of target clients or even a single client target, you will have to allocate a `new ulong[]`. This pattern can quickly lead into lots of heap allocations and pressure GC which would cause GC spikes at runtime. We suggest developers cache their `ulong[]` variables or use an array pool to cycle `ulong[]` instances so that it would cause less heap allocations. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md index b46a1b8b91..ac95d63bd7 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md @@ -328,4 +328,4 @@ void Update() ## Additional resources * [RPC parameters](rpc-params.md) -* [Customizing serialization](../custom-serialization.md#remote-procedure-call-rpc) +* [Customizing serialization](../custom-serialization.md#remote-procedure-call-rpcs) diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-prefab-handler.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-prefab-handler.md index 6608534375..8eab667a68 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-prefab-handler.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-prefab-handler.md @@ -2,7 +2,7 @@ The network prefab handler system provides advanced control over how network prefabs are instantiated and destroyed during runtime. You can use it to override the default Netcode for GameObjects [object spawning](../basics/object-spawning.md) behavior by implementing custom prefab handlers. -The network prefab handler system is accessible from the [NetworkManager](../components/networkmanager.md) as `NetworkManager.PrefabHandler`. +The network prefab handler system is accessible from the [NetworkManager](../components/core/networkmanager.md) as `NetworkManager.PrefabHandler`. ## When to use a prefab handler @@ -13,14 +13,14 @@ For an overview of the default object spawning behavior, refer to the [object sp - **Custom initialization**: Setting up objects with game client specific data or configurations. - **Conditional spawning**: Initializing different prefab variants based on runtime conditions. -The prefab handler system addresses these needs through an interface-based architecture. The system relies on two key methods: `Instantiate` and `Destroy`. `Instantiate` is called on non-authority clients when an [authority](../terms-concepts/authority.md) spawns a new [NetworkObject](../basics/networkobject.md) that has a registered network prefab handler. `Destroy` is called on all game clients whenever a registered [NetworkObject](../basics/networkobject.md) is destroyed. +The prefab handler system addresses these needs through an interface-based architecture. The system relies on two key methods: `Instantiate` and `Destroy`. `Instantiate` is called on non-authority clients when an [authority](../terms-concepts/authority.md) spawns a new [NetworkObject](../components/core/networkobject.md) that has a registered network prefab handler. `Destroy` is called on all game clients whenever a registered [NetworkObject](../components/core/networkobject.md) is destroyed. ## Create a prefab handler Prefab handlers are classes that implement one of the Netcode for GameObjects prefab handler descriptions. There are currently two such descriptions: -- [**INetworkPrefabInstanceHandler**](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.INetworkPrefabInstanceHandler.html): This is the simplest interface for custom prefab handlers. -- [**NetworkPrefabInstanceHandlerWithData**](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkPrefabInstanceHandlerWithData.html): This specialized handler receives custom data from the authority during spawning, enabling dynamic prefab customization. +- [**INetworkPrefabInstanceHandler**](xref:Unity.Netcode.INetworkPrefabInstanceHandler): This is the simplest interface for custom prefab handlers. +- [**NetworkPrefabInstanceHandlerWithData**](xref:Unity.Netcode.NetworkPrefabInstanceHandlerWithData): This specialized handler receives custom data from the authority during spawning, enabling dynamic prefab customization. When using a prefab handler, Netcode for GameObjects uses the `Instantiate` and `Destroy` methods instead of default spawn handlers for the NetworkObject during spawning and despawning. The authority instance uses the traditional spawning approach where it will, via user script, instantiate and spawn a network prefab (even for those registered with a prefab handler). However, all non-authority clients will automatically use the instantiate method defined by the `INetworkPrefabInstanceHandler` implementation if the network prefab spawned has a registered `INetworkPrefabInstanceHandler` implementation with the `NetworkPrefabHandler` (`NetworkManager.PrefabHandler`). @@ -55,7 +55,7 @@ public abstract class NetworkPrefabInstanceHandlerWithData : INetworkPrefabIn ## Register a prefab handler -Once you've [created a prefab handler](#create-a-prefab-handler), whether by implementing or deriving, you need to register any new instance of that handler with the network prefab handler system using `NetworkManager.PrefabHandler.AddHandler`. Prefab handlers are registered against a NetworkObject's [GlobalObjectIdHash](../basics/networkobject.md#using-networkobjects). +Once you've [created a prefab handler](#create-a-prefab-handler), whether by implementing or deriving, you need to register any new instance of that handler with the network prefab handler system using `NetworkManager.PrefabHandler.AddHandler`. Prefab handlers are registered against a NetworkObject's [GlobalObjectIdHash](../components/core/networkobject.md#using-networkobjects). ```csharp public class GameManager : NetworkBehaviour @@ -70,7 +70,7 @@ public class GameManager : NetworkBehaviour } ``` -To un-register a prefab handler, you can [invoke the `NetworkManager.PrefabHandler.RemoveHandler` method](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkPrefabHandler.html#Unity_Netcode_NetworkPrefabHandler_RemoveHandler_System_UInt32_). There are several override versions of this method. +To un-register a prefab handler, you can [invoke the `NetworkManager.PrefabHandler.RemoveHandler` method](xref:Unity.Netcode.NetworkPrefabHandler.RemoveHandler*). There are several override versions of this method. ## Object spawning with prefab handlers diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-update-loop-system/network-update-loop-reference.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-update-loop-system/network-update-loop-reference.md index fd013937a4..72ec0db77c 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-update-loop-system/network-update-loop-reference.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/network-update-loop-system/network-update-loop-reference.md @@ -6,7 +6,7 @@ The following diagrams provide insight into the Network Update Loop process and
-![Injecting NetworkUpdateLoop Systems Into PlayerLoop](../images/injecting-networkupdatesloop.svg) +![Injecting NetworkUpdateLoop Systems Into PlayerLoop](../../images/injecting-networkupdatesloop.svg)
@@ -14,6 +14,6 @@ The following diagrams provide insight into the Network Update Loop process and
-![NetworkUpdateLoop Running INetworkUpdateSystem Updates](../images/runninginetworkupdatesystemupdates.svg) +![NetworkUpdateLoop Running INetworkUpdateSystem Updates](../../images/runninginetworkupdatesystemupdates.svg)
diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networkobject-parenting.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networkobject-parenting.md index 435edf39a5..a2c6c755ea 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networkobject-parenting.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networkobject-parenting.md @@ -26,7 +26,7 @@ If you aren't familiar with transform parenting in Unity, then it's recommended ### OnNetworkObjectParentChanged -[`NetworkBehaviour.OnNetworkObjectParentChanged`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_OnNetworkObjectParentChanged_Unity_Netcode_NetworkObject_) is a virtual method you can override to be notified when a NetworkObject component's parent has changed. The [`MonoBehaviour.OnTransformParentChanged()`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTransformParentChanged.html) method is used by NetworkObject component to catch `transform.parent` changes and notify its associated NetworkBehaviour components. +[`NetworkBehaviour.OnNetworkObjectParentChanged`](xref:Unity.Netcode.NetworkBehaviour.OnNetworkObjectParentChanged*) is a virtual method you can override to be notified when a NetworkObject component's parent has changed. The [`MonoBehaviour.OnTransformParentChanged()`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTransformParentChanged.html) method is used by NetworkObject component to catch `transform.parent` changes and notify its associated NetworkBehaviour components. ```csharp /// @@ -49,7 +49,7 @@ The [owner](../terms-concepts/ownership.md) of a NetworkObject can always parent By default, only the [authority](../terms-concepts/authority.md) of a NetworkObject can parent a NetworkObject under a non-networked object. This means in a client-server game, only the server (or host) can control NetworkObject component parenting. In a distributed authority game the [owner](../terms-concepts/ownership.md) of the object can always parent the object. -To allow the [owner](../terms-concepts/ownership.md) to parent their owned NetworkObject in a client-server game, use the [`NetworkObject.AllowOwnerToParent`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_AllowOwnerToParent) property. +To allow the [owner](../terms-concepts/ownership.md) to parent their owned NetworkObject in a client-server game, use the [`NetworkObject.AllowOwnerToParent`](xref:Unity.Netcode.NetworkObject.AllowOwnerToParent) property. ![image](../images/networkobject/allowOwnerToParent.png) @@ -78,7 +78,7 @@ If you plan on parenting in-scene placed NetworkObject components with a player For more information, refer to: - [Real World In-scene NetworkObject Parenting of Players Solution](inscene_parenting_player.md) -- [Scene Event Notifications](../basics/scenemanagement/scene-events#scene-event-notifications) +- [Scene Event Notifications](../basics/scenemanagement/scene-events.md#scene-event-notifications) - [In-Scene NetworkObjects](../basics/scenemanagement/inscene-placed-networkobjects.md) ### WorldPositionStays usage diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networktime-ticks.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networktime-ticks.md index 1742f87805..500b3d4b7c 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networktime-ticks.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/networktime-ticks.md @@ -183,6 +183,6 @@ For games with short play sessions casting the time to float is safe or `TimeAsF > [!NOTE] > The properties of the `NetworkTimeSystem` should be left untouched on the server/host. Changing the values on the client is sufficient to change the behavior of the time system. -The way network time gets calculated can be configured in the `NetworkTimeSystem` if needed. Refer to the [API docs](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkTimeSystem.html) for information about the properties which can be modified. All properties can be safely adjusted at runtime. For instance, buffer values can be increased for a player with a bad connection. +The way network time gets calculated can be configured in the `NetworkTimeSystem` if needed. Refer to the [API docs](xref:Unity.Netcode.NetworkTimeSystem) for information about the properties which can be modified. All properties can be safely adjusted at runtime. For instance, buffer values can be increased for a player with a bad connection. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/physics.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/physics.md index 8a309cca24..134a78cb43 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/physics.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/physics.md @@ -34,7 +34,7 @@ Since PhysX has no concept of local space, it can be difficult to synchronize tw ## Using AttachableBehaviour or Joint -The implementation of physics in a networked project differs from a single player project. This is especially true when you're using NetworkTransform and NetworkRigidbody components with [`NetworkRigidbody.UseRigidBodyForMotion`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Components.NetworkRigidbodyBase.html#Unity_Netcode_Components_NetworkRigidbodyBase_UseRigidBodyForMotion) enabled. Deciding whether to use a Joint or an AttachableBehaviour component depends on your project's requirements. +The implementation of physics in a networked project differs from a single player project. This is especially true when you're using NetworkTransform and NetworkRigidbody components with [`NetworkRigidbody.UseRigidBodyForMotion`](xref:Unity.Netcode.Components.NetworkRigidbodyBase.UseRigidBodyForMotion) enabled. Deciding whether to use a Joint or an AttachableBehaviour component depends on your project's requirements. For example, if you want to create world items that players can pick up, you may have the following requirements: diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializable.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializable.md index 2733a0e373..ab60e161c6 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializable.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializable.md @@ -1,7 +1,7 @@ # Customize serializable types with INetworkSerializable > [!NOTE] -> Read the [Serialization overview](./serialization/serialization-overview.md) page to understand the basics of serialization before customizing serializable types with `INetworkSerializable`. +> Read the [Serialization overview](./serialization-overview.md) page to understand the basics of serialization before customizing serializable types with `INetworkSerializable`. You can use the `INetworkSerializable` interface to define custom serializable types. This interface has one function: `NetworkSerialize(BufferSerializer serializer)`, which ingests a bi-directional [`BufferSerializer`](../bufferserializer.md) that you can use to implement bi-directional custom serialization. @@ -23,7 +23,7 @@ struct SpawnPoint : INetworkSerializable } ``` -Types implementing `INetworkSerializable` are supported by [`FastBufferReader` and `FastBufferWriter`](./fastbufferwriter-fastbufferreader.md), [`RPC`s'](../message-system/rpc.md), and [`NetworkVariable`s](../../basics/networkvariable.md). +Types implementing `INetworkSerializable` are supported by [`FastBufferReader` and `FastBufferWriter`](../fastbufferwriter-fastbufferreader.md), [`RPC`s'](../message-system/rpc.md), and [`NetworkVariable`s](../../basics/networkvariable.md). ```csharp [Rpc(SendTo.Server)] diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializebymemcpy.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializebymemcpy.md index 212bfbf339..b79df9ff27 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializebymemcpy.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/inetworkserializebymemcpy.md @@ -1,7 +1,7 @@ # Serialize unmanaged structs with INetworkSerializeByMemcpy > [!NOTE] -> Read the [Serialization overview](./serialization/serialization-overview.md) page to understand the basics of serialization before using `INetworkSerializeByMemcpy` to serialize unmanaged structs. +> Read the [Serialization overview](./serialization-overview.md) page to understand the basics of serialization before using `INetworkSerializeByMemcpy` to serialize unmanaged structs. The `INetworkSerializeByMemcpy` interface is used to mark an unmanaged struct type as being trivially serializable over the network by directly copying the whole struct, byte-for-byte, as it appears in memory, into and out of the buffer. This can offer some benefits for performance compared to serializing one field at a time, especially if the struct has many fields in it, but it may be less efficient from a bandwidth-usage perspective, as fields will often be padded for memory alignment and you won't be able to "pack" any of the fields to optimize for space usage. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/networkobject-serialization.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/networkobject-serialization.md index 466d545b4b..d3800a7b09 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/networkobject-serialization.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/networkobject-serialization.md @@ -1,7 +1,7 @@ # NetworkObject and NetworkBehaviour serialization > [!NOTE] -> Read the [Serialization overview](./serialization/serialization-overview.md) page to understand the basics of serialization before learning how to serialize `NetworkObjects` and `NetworkBehaviours`. +> Read the [Serialization overview](./serialization-overview.md) page to understand the basics of serialization before learning how to serialize `NetworkObjects` and `NetworkBehaviours`. `GameObject`, [`NetworkObject`](../../components/core/networkobject.md) and [`NetworkBehaviour`](../../components/core/networkbehaviour.md) aren't serializable types so they can't be used in [`RPC`s](../message-system/rpc.md) or [`NetworkVariable`s](../../basics/networkvariable.md) by default. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-arrays.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-arrays.md index 5681e5952c..3ecc26cb99 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-arrays.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-arrays.md @@ -1,7 +1,7 @@ # Arrays and native containers > [!NOTE] -> Read the [Serialization overview](./serialization/serialization-overview.md) page to understand the basics of serialization before learning how to serialize arrays and native containers. +> Read the [Serialization overview](./serialization-overview.md) page to understand the basics of serialization before learning how to serialize arrays and native containers. Netcode for GameObjects has built-in serialization code for arrays of [C# value-type primitives](cprimitives.md), like `int[]`, and [Unity primitive types](unity-primitives.md). Any arrays of types that aren't handled by the built-in serialization code, such as custom types, need to be handled using a container class or structure that implements the [`INetworkSerializable`](inetworkserializable.md) interface. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-overview.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-overview.md index fb52e42773..ad7fcd4d21 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-overview.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/serialization/serialization-overview.md @@ -10,7 +10,7 @@ When Netcode for GameObjects first receives a type, it checks for any custom typ By default, any type that satisfies the unmanaged generic constraint can be automatically serialized as RPC parameters. This includes all basic types (bool, byte, int, float, enum, for example), as well as any structs that contain only these basic types. -Serialization and deserialization is done via the structs [`FastBufferWriter` and `FastBufferReader`](fastbufferwriter-fastbufferreader.md). These have methods for serializing individual types and methods for serializing packed numbers, but in particular provide a high-performance method called `WriteValue()/ReadValue()` (for Writers and Readers, respectively) that can extremely quickly write an entire unmanaged struct to a buffer. +Serialization and deserialization is done via the structs [`FastBufferWriter` and `FastBufferReader`](../fastbufferwriter-fastbufferreader.md). These have methods for serializing individual types and methods for serializing packed numbers, but in particular provide a high-performance method called `WriteValue()/ReadValue()` (for Writers and Readers, respectively) that can extremely quickly write an entire unmanaged struct to a buffer. `FastBufferWriter` and `FastBufferReader` also contain the functions `FastBufferWriter.WriteNetworkSerializable()` and `FastBufferReader.ReadNetworkSerializable` for writing and reading values that use the `INetworkSerializable` interface. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/session-management.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/session-management.md index 1f80a08d1a..614d2ce32b 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/session-management.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/session-management.md @@ -19,7 +19,7 @@ You can also decide to clear all data when a session completes or add a timeout # Reconnection -The best way to reconnect players depends on your game. For example, if you use a [Player Object](../components/core/networkobject.md#player-objects), a new `Default Player Prefab` automatically spawns when a player connects to the game (including when they reconnect). You can use the player's earlier saved session data to update that object so that it returns to the same state before disconnecting. In those cases, you would need to keep all the important data that you want to restore and map it to the player using your identification system. You can save this data when a player disconnects or update it periodically. You can then use the `OnNetworkSpawn` event on the Player Object's `NetworkBehavior`(s) to get this data and apply it where needed. +The best way to reconnect players depends on your game. For example, if you use a [Player Object](../components/core/playerobjects.md), a new `Default Player Prefab` automatically spawns when a player connects to the game (including when they reconnect). You can use the player's earlier saved session data to update that object so that it returns to the same state before disconnecting. In those cases, you would need to keep all the important data that you want to restore and map it to the player using your identification system. You can save this data when a player disconnects or update it periodically. You can then use the `OnNetworkSpawn` event on the Player Object's `NetworkBehavior`(s) to get this data and apply it where needed. In cases where we don't use the Player Object approach and instead manually attribute client ownership to NetworkObject(s), we can keep the objects that a player owns when they disconnect, and set the reconnected player as their new owner. To accomplish this, the only data we would need to keep would be the mapping between those objects and their owning player's identifier, then when a player reconnects we can use this mapping to set them as the new owner. This mapping can be as simple as a dictionary mapping the player identifier with the `NetworkObjectId`(s) of the NetworkObject(s) they own. Then, in the `OnClientConnectedCallback` from the NetworkManager, the server can set the ownership of these objects. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/singleplayer.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/singleplayer.md index e4f45a5ead..b0d54e88be 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/singleplayer.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/singleplayer.md @@ -1,6 +1,6 @@ # Single player sessions -Netcode for GameObjects provides a [SinglePlayerTransport](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.13/api/Unity.Netcode.Transports.SinglePlayer.SinglePlayerTransport.html) which derives from [NetworkTransport](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.13/api/Unity.Netcode.NetworkTransport.html). +Netcode for GameObjects provides a [SinglePlayerTransport](xref:Unity.Netcode.Transports.SinglePlayer.SinglePlayerTransport) which derives from [NetworkTransport](xref:Unity.Netcode.NetworkTransport). This provides the ability to run a hosted session using the single player transport without having to modify your primary netcode script. diff --git a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/transports.md b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/transports.md index 1939d8a0ea..783f0f633c 100644 --- a/com.unity.netcode.gameobjects/Documentation~/advanced-topics/transports.md +++ b/com.unity.netcode.gameobjects/Documentation~/advanced-topics/transports.md @@ -16,7 +16,7 @@ A transport layer can provide: ## Unity Transport package -Netcode's default transport Unity Transport is an entire transport layer that you can use to add multiplayer and network features to your project with or without Netcode. See the Transport [documentation](../../../transport/current/about) for more information and how to [install](../../../transport/current/install). +Netcode's default transport Unity Transport is an entire transport layer that you can use to add multiplayer and network features to your project with or without Netcode. Refer to the Transport [documentation](https://docs.unity3d.com/Packages/com.unity.transport@latest) for more information and how to [install](https://docs.unity3d.com/Packages/com.unity.transport@latest?subfolder=/manual/install.html). ## Unity's UNet Transport Layer API diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/custom-networkvariables.md b/com.unity.netcode.gameobjects/Documentation~/basics/custom-networkvariables.md index de160d26d2..7c6dd428a7 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/custom-networkvariables.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/custom-networkvariables.md @@ -3,7 +3,7 @@ In addition to the standard [`NetworkVariable`s](networkvariable.md) available in Netcode for GameObjects, you can also create custom `NetworkVariable`s for advanced implementations. The `NetworkVariable` and `NetworkList` classes were created as `NetworkVariableBase` class implementation examples. While the `NetworkVariable` class is considered production ready, you might run into scenarios where you have a more advanced implementation in mind. In this case, you can create your own custom implementation. > [!NOTE] -> Read the [Serialization overview](./serialization/serialization-overview.md) page to understand how Netcode for GameObjects handles serialization. +> Read the [Serialization overview](../advanced-topics/serialization/serialization-overview.md) page to understand how Netcode for GameObjects handles serialization. To create your own `NetworkVariableBase`-derived container, you should: diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/object-spawning.md b/com.unity.netcode.gameobjects/Documentation~/basics/object-spawning.md index 7fdd95ee4d..b72213f32e 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/object-spawning.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/object-spawning.md @@ -30,7 +30,7 @@ When using a [server authoritative networking model](../terms-concepts/authority To spawn a network prefab, you must first create an instance of the network prefab and then invoke the spawn method on the NetworkObject component of the instance you created. In most cases, you will want to keep the NetworkObject component attached to the root GameObject of the network prefab. -Refer to [NetworkObject ownership](../advanced-topics/networkobject-ownership.md) for more information. +Refer to [NetworkObject ownership](../components/core/networkobject-ownership.md) for more information. The following is a basic example of how to spawn a network prefab instance: diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/custom-management.md b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/custom-management.md index dff54d2da4..ffb1cde762 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/custom-management.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/custom-management.md @@ -39,7 +39,7 @@ Once you've registered your in-scene placed Network Prefabs with your `NetworkPr > When a client first connects, it deletes any in-scene placed `NetworkObjects` in any of the scenes it has currently loaded. When using a custom scene management solution, in-scene placed NetworkObjects are actually dynamically spawned. This means any changes you make to your in-scene placed Network Prefabs will *not* be synchronized with clients automatically. ### Synchronizing In-Scene Placed Network Prefab Instances -If you want to change an in-scene placed network prefab instance, you need to handle the serialization of these settings yourself. You can do this by overriding `NetworkBehaviour.OnSynchronize` and serializing any property updates you want to have synchronized with clients when they join. [Read More About OnSynchronize Here](../../components/core/networkbehaviour.md#prespawn-synchronization). +If you want to change an in-scene placed network prefab instance, you need to handle the serialization of these settings yourself. You can do this by overriding `NetworkBehaviour.OnSynchronize` and serializing any property updates you want to have synchronized with clients when they join. [Read More About OnSynchronize Here](../../components/core/networkbehaviour-synchronize.md#prespawn-synchronization-with-onsynchronize). ## Starting a Netcode Enabled Game Session The recommended way of starting session using your own scene management solution is to assure that when a client attempts to join a netcode game session it should already have (as best as possible) any scenes that the server might have loaded. While this does not assure that your newly connecting client will load any additional scenes that might have been loaded, using this approach initially will get you started so you can then come up with a strategy to handling: diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/inscene-placed-networkobjects.md b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/inscene-placed-networkobjects.md index 0cf6db3bff..66cdfedf1e 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/inscene-placed-networkobjects.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/inscene-placed-networkobjects.md @@ -228,7 +228,7 @@ The above example keeps track of whether the in-scene placed NetworkObject has s ### Synchronizing late-joining clients when an in-scene placed NetworkObject has been despawned and destroyed -Referring back to the [section on complex in-scene NetworkObjects](#complex-in-scene-networkobjects), it's recommended to use dynamically spawned NetworkObjects if you intend to destroy the object when it's despawned. However, if either despawning but not destroying or using the [hybrid approach](#a-hybrid-approach-example) don't appear to be options for your project's needs, then there are two other possible (but not recommended) alternatives: +Referring back to the [section on complex in-scene NetworkObjects](#complex-in-scene-networkobjects), it's recommended to use dynamically spawned NetworkObjects if you intend to destroy the object when it's despawned. However, if either despawning but not destroying or using the [hybrid approach](#hybrid-approach) don't appear to be options for your project's needs, then there are two other possible (but not recommended) alternatives: - Have another in-scene placed NetworkObject track which in-scene placed NetworkObjects have been destroyed and upon a player late-joining (that is, `OnClientConnected`) you would need to send the newly-joined client the list of in-scene placed NetworkObjects that it should destroy. This adds an additional in-scene placed NetworkObject to your scene hierarchy and will consume memory keeping track of what was destroyed. - Disable the visual and physics-related components (in Editor as a default) of the in-scene placed NetworkObject(s) in question and only enable them in `OnNetworkSpawn`. This doesn't delete/remove the in-scene placed NetworkObject(s) for the late-joining client and can be tricky to implement without running into edge case scenario bugs. diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/scene-events.md b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/scene-events.md index 817affd33f..c01ffa1df5 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/scene-events.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/scene-events.md @@ -240,7 +240,7 @@ So, the big "take-away" from the above table is that you need to understand the ### SceneEventType Specific Notifications There might be a time where you aren't interested in all of the details for each scene event type that occurs. As it just so happens, `NetworkSceneManager` includes a single delegate handler for each `SceneEventType` that is only triggered for the associated `SceneEventType`. -You can explore the [NetworkSceneManager](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.SceneEventType.html) for a full listing of the corresponding single `SceneEventType` events. +You can explore the [NetworkSceneManager](xref:Unity.Netcode.SceneEventType) for a full listing of the corresponding single `SceneEventType` events. Some examples: - NetworkSceneManager.OnLoad: Triggered when for `OnLoad` scene events. - NetworkSceneManager.OnUnload: Triggered when for `OnUnload` scene events. diff --git a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/using-networkscenemanager.md b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/using-networkscenemanager.md index 5837249132..ac54460414 100644 --- a/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/using-networkscenemanager.md +++ b/com.unity.netcode.gameobjects/Documentation~/basics/scenemanagement/using-networkscenemanager.md @@ -19,7 +19,7 @@ > [!NOTE] > In-Scene placed NetworkObjects can be used in many ways and are treated uniquely from that of dynamically spawned NetworkObjects. An in-scene placed NetworkObject is a GameObject with a NetworkObject and typically at least one NetworkBehaviour component attached to a child of or the same GameObject. it's recommended to read through all integrated scene management materials (this document, [Scene Events](scene-events.md), and [Timing Considerations](timing-considerations.md)) before learning about more advanced [In-Scene (placed) NetworkObjects](inscene-placed-networkobjects.md) topics. -All of these scene management features (and more) are handled by the [`NetworkSceneManager`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkSceneManager.html). +All of these scene management features (and more) are handled by the [`NetworkSceneManager`](xref:Unity.Netcode.NetworkSceneManager). ### Accessing `NetworkSceneManager` The `NetworkSceneManager` lives within the NetworkManager and is instantiated when the NetworkManager is started. @@ -122,7 +122,7 @@ The purpose behind the above outline is to show that a Scene Event can lead to o #### Scene Event Notifications You can be notified of scene events by registering in one of two ways: 1. Receive all scene event notification types: `NetworkSceneManager.OnSceneEvent` -2. Receive only a specific scene event notification type: [`NetworkSceneManager`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkSceneManager.html#events) has one for each [`SceneEventType`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.SceneEventType.html)
+2. Receive only a specific scene event notification type: [`NetworkSceneManager`](xref:Unity.Netcode.NetworkSceneManager) has one for each [`SceneEventType`](xref:Unity.Netcode.SceneEventType)
> [!NOTE] > Receiving (via subscribing to the associated event callback) only specific scene event notification types does not change how a server or client receives and processes notifications. @@ -137,7 +137,7 @@ Typically, this is used with clients or components that might only need to be no You might want to register for the `SceneEventType.LoadEventCompleted` scene event type to know, from a client perspective, that the server and all other clients have finished loading a scene. This notification lets you know when you can start performing other netcode related actions on the newly loaded and spawned NetworkObjects. #### Scene Event Progress Status -As we discussed in the earlier code example, it's important to check the status returned by `NetworkSceneManager.Load` to make sure your scene loading event has started. The following is a list of all [SceneEventProgressStatus](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.SceneEventProgressStatus.html) `enum` values with some additional helpful information: +As we discussed in the earlier code example, it's important to check the status returned by `NetworkSceneManager.Load` to make sure your scene loading event has started. The following is a list of all [SceneEventProgressStatus](xref:Unity.Netcode.SceneEventProgressStatus) `enum` values with some additional helpful information: - Started - The scene event has started (success) - SceneNotLoaded diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/corecomponents.md b/com.unity.netcode.gameobjects/Documentation~/components/core/corecomponents.md index 8c4c49d2d8..b07a4113cf 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/corecomponents.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/corecomponents.md @@ -20,7 +20,7 @@ Learn about the three core components of Netcode for GameObjects: NetworkObject, | **Topic** | **Description** | | :------------------------------ | :------------------------------- | -| **[NetworkBehaviour](networkbehaviour.md)** | [NetworkBehaviour](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. | +| **[NetworkBehaviour](networkbehaviour.md)** | [NetworkBehaviour](xref:Unity.Netcode.NetworkBehaviour) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. | | **[Synchronizing](networkbehaviour-synchronize.md)** | Understand a NetworkBehaviour component's order of operations when it comes to spawning, despawning, and adding custom synchronization data. | diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-ownership.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-ownership.md index 3511fd44f8..fee658cd12 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-ownership.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-ownership.md @@ -1,25 +1,25 @@ # NetworkBehaviour ownership -Before reading these docs, ensure you understand the concepts of [ownership](../terms-concepts/ownership.md) and [NetworkObject ownership](./networkobject-ownership.md). It's also important to be familiar with the [NetworkBehaviour](./networkbehaviour.md) +Before reading these docs, ensure you understand the concepts of [ownership](../../terms-concepts/ownership.md) and [NetworkObject ownership](./networkobject-ownership.md). It's also important to be familiar with the [NetworkBehaviour](./networkbehaviour.md) -The owner of each NetworkBehaviour in your game is decided by the owner of that NetworkBehaviour's NetworkObject. The NetworkObject is found as a property on the NetworkBehaviour: [`NetworkBehaviour.NetworkObject`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_NetworkObject). +The owner of each NetworkBehaviour in your game is decided by the owner of that NetworkBehaviour's NetworkObject. The NetworkObject is found as a property on the NetworkBehaviour: [`NetworkBehaviour.NetworkObject`](xref:Unity.Netcode.NetworkBehaviour.NetworkObject). ## Helpful properties > [!NOTE] -> The following properties are only valid if the NetworkBehaviour has been spawned. Use [`NetworkBehaviour.IsSpawned`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsSpawned) to check the spawned status of the NetworkBehaviour +> The following properties are only valid if the NetworkBehaviour has been spawned. Use [`NetworkBehaviour.IsSpawned`](xref:Unity.Netcode.NetworkBehaviour.IsSpawned) to check the spawned status of the NetworkBehaviour -To identify whether the local client is the owner of a NetworkBehaviour, you can check the[`NetworkBehaviour.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwner) property. +To identify whether the local client is the owner of a NetworkBehaviour, you can check the[`NetworkBehaviour.IsOwner`](xref:Unity.Netcode.NetworkBehaviour.IsOwner) property. -To identify whether the server owns a NetworkBehaviour, you can check the [`NetworkBehaviour.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwnedByServer) property. +To identify whether the server owns a NetworkBehaviour, you can check the [`NetworkBehaviour.IsOwnedByServer`](xref:Unity.Netcode.NetworkBehaviour.IsOwnedByServer) property. -To identify whether the local client has authority of a NetworkBehaviour, you can check the[`NetworkBehaviour.HasAuthority`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_HasAuthority) property. +To identify whether the local client has authority of a NetworkBehaviour, you can check the[`NetworkBehaviour.HasAuthority`](xref:Unity.Netcode.NetworkBehaviour.HasAuthority) property. ## Detecting ownership changes There are three functions that can be implemented to detect ownership changes on a NetworkBehaviour. These functions are invoked in the order they are listed here. -### [OnLostOwnership](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_OnLostOwnership) +### [OnLostOwnership](xref:Unity.Netcode.NetworkBehaviour.OnLostOwnership) When using a [client-server network topology](../../terms-concepts/client-server.md) `OnLostOwnership` is invoked on both the server any time a connected client loses ownership of this NetworkBehaviour. It is also invoked on the game client who just lost ownership. @@ -34,7 +34,7 @@ void OnLostOwnership() } ``` -### [OnGainedOwnership](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_OnGainedOwnership) +### [OnGainedOwnership](xref:Unity.Netcode.NetworkBehaviour.OnGainedOwnership) When using a client-server network topology `OnGainedOwnership` is invoked on the server any time ownership is gained. It is also be invoked on the game client who just gained ownership. @@ -52,7 +52,7 @@ void OnGainedOwnership() } ``` -### [OnOwnershipChanged](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_OnOwnershipChanged_System_UInt64_System_UInt64_) +### [OnOwnershipChanged](xref:Unity.Netcode.NetworkBehaviour.OnOwnershipChanged*) Whenever you want notification on any and all ownership changes, implement the `OnOwnershipChanged` method. `OnOwnershipChanged` is invoked on all connected game clients whenever the ownership of the NetworkBehaviour it is implemented on changes. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-synchronize.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-synchronize.md index 166b69c4bc..e273296ea5 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-synchronize.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-synchronize.md @@ -1,6 +1,6 @@ # NetworkBehaviour synchronization -[NetworkBehaviour](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. +[NetworkBehaviour](xref:Unity.Netcode.NetworkBehaviour) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. You can use NetworkBehaviours to synchronize settings before, during, and after spawning NetworkObjects. @@ -238,4 +238,4 @@ However, there is an additional check to assure that the total expected bytes to ## Serializing NetworkBehaviours -NetworkBehaviours require the use of specialized [`NetworkBehaviourReference`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviourReference.html) structures to be serialized and used with RPCs and `NetworkVariable`s. +NetworkBehaviours require the use of specialized [`NetworkBehaviourReference`](xref:Unity.Netcode.NetworkBehaviourReference) structures to be serialized and used with RPCs and `NetworkVariable`s. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour.md index 0922a6d35a..4b1f7e0b02 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour.md @@ -1,6 +1,6 @@ # NetworkBehaviour -[NetworkBehaviour](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. +[NetworkBehaviour](xref:Unity.Netcode.NetworkBehaviour) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](networkobject.md) component and at least one NetworkBehaviour component. A NetworkBehaviour requires a NetworkObject component on the same relative GameObject or on a parent of the GameObject with the NetworkBehaviour component assigned to it. If you add a NetworkBehaviour to a GameObject that doesn't have a NetworkObject (or any parent), then Netcode for GameObjects automatically adds a NetworkObject component to the GameObject in which the NetworkBehaviour was added. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkmanager.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkmanager.md index aa59d87d89..2a487b20a6 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkmanager.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkmanager.md @@ -5,7 +5,7 @@ The NetworkManager is a required Netcode for GameObjects component that has all ## NetworkManager Inspector properties - **LogLevel**: Sets the network logging level -- **PlayerPrefab**: When a Prefab is assigned, the Prefab will be instantiated as the player object. For more information about player prefabs, refer to [Player NetworkObjects](networkobject.md#player-networkobjects). +- **PlayerPrefab**: When a Prefab is assigned, the Prefab will be instantiated as the player object. For more information about player prefabs, refer to [Player NetworkObjects](playerobjects.md). - **NetworkPrefabs**: Where you register your network prefabs. You can also create a single network Prefab override per registered network Prefab here. - **Protocol Version**: Set this value to help distinguish between builds when the most current build has new assets that can cause issues with older builds connecting. - **Network Transport**: Where your network specific settings and transport type is set. When using a [client-server topology](../../terms-concepts/client-server.md), This field accepts any INetworkTransport implementation. However, unless you have unique transport specific needs UnityTransport is the recommended transport to use with Netcode for GameObjects. For a [distributed authority topology](../../terms-concepts/distributed-authority.md), refer to the [distributed authority quickstart](../../learn/distributed-authority-quick-start.md). @@ -68,7 +68,7 @@ NetworkManager.Singleton.StartClient(); When starting a Server or joining an already started session as client, the NetworkManager can spawn a "Player Object" belonging to the client. For more information about player prefabs, refer to: - [NetworkObject Player Prefab Documentation](networkobject.md) - - [Connection Approval](../../basics/connection-approval) + - [Connection Approval](../../basics/connection-approval.md) ## Connecting @@ -135,7 +135,7 @@ The server-host attempts to wait for all client connections to close before it f At times you might need to disconnect a client for various reasons without shutting down the server. To do this, you can call the `NetworkManager.DisconnectClient` method while passing the identifier of the client you wish to disconnect as the only parameter. The client identifier can be found within: -- The `NetworkManager.ConnectedClients` dictionary that uses the client identifier as a key and the value as the [`NetworkClient`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkClient.html). +- The `NetworkManager.ConnectedClients` dictionary that uses the client identifier as a key and the value as the [`NetworkClient`](xref:Unity.Netcode.NetworkClient). - As a read only list of `NetworkClients` via the `NetworkManager.ConnectedClientsList`. - A full list of all connected client identifiers can be accessed via `NetworkManager.ConnectedClientsIds`. - The client identifier is passed as a parameter to all subscribers of the `NetworkManager.OnClientConnected` event. @@ -261,16 +261,16 @@ public class ConnectionNotificationManager : MonoBehaviour There are two static NetworkManager events you can use to be notified when a NetworkManager is instantiated or is about to be destroyed: -- [`NetworkManager.OnInstantiated`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnInstantiated): This is invoked when a NetworkManager is instantiated. -- [`NetworkManager.OnDestroying`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnDestroying): This is invoked when a NetworkManager is about to be destroyed. +- [`NetworkManager.OnInstantiated`](xref:Unity.Netcode.NetworkManager.OnInstantiated): This is invoked when a NetworkManager is instantiated. +- [`NetworkManager.OnDestroying`](xref:Unity.Netcode.NetworkManager.OnDestroying): This is invoked when a NetworkManager is about to be destroyed. ### When a NetworkManager is stopped Knowing when a NetworkManager has stopped is useful for establishing when it's safe to transition back to a main menu scene, or other similar tasks. There are two events you can use to be notified that the NetworkManager has finished shutting down: -- [`NetworkManager.OnClientStopped`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnClientStopped): This is invoked on a host or client when the NetworkManager has completely shut down and is ready to be restarted. -- [`NetworkManager.OnServerStopped`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnServerStopped): This is invoked on a host or server when the NetworkManager has completely shut down and is ready to be restarted. +- [`NetworkManager.OnClientStopped`](xref:Unity.Netcode.NetworkManager.OnClientStopped): This is invoked on a host or client when the NetworkManager has completely shut down and is ready to be restarted. +- [`NetworkManager.OnServerStopped`](xref:Unity.Netcode.NetworkManager.OnServerStopped): This is invoked on a host or server when the NetworkManager has completely shut down and is ready to be restarted. Since a host is both a client and a server, the event invocation order is: @@ -283,4 +283,4 @@ Since a host is both a client and a server, the event invocation order is: If you need to save the state of spawned objects before they're destroyed when the NetworkManager shuts down, you can use the following event notification: -- [`NetworkManager.OnPreShutdown`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnPreShutdown): This is invoked prior to finalizing the NetworkManager shut down process. Any remaining spawned objects will still be instantiated and spawned when this event is invoked. +- [`NetworkManager.OnPreShutdown`](xref:Unity.Netcode.NetworkManager.OnPreShutdown): This is invoked prior to finalizing the NetworkManager shut down process. Any remaining spawned objects will still be instantiated and spawned when this event is invoked. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject-ownership.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject-ownership.md index 81bad2dfff..3ad5d5235b 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject-ownership.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject-ownership.md @@ -9,11 +9,11 @@ Read more about how to detect when ownership has changed in [NetworkBehaviour ow ## Helpful properties > [!NOTE] -> All NetworkObject properties are only valid while the NetworkObject is spawned. Use [`NetworkObject.IsSpawned`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsSpawned) to check the spawned status of the NetworkObject. +> All NetworkObject properties are only valid while the NetworkObject is spawned. Use [`NetworkObject.IsSpawned`](xref:Unity.Netcode.NetworkObject.IsSpawned) to check the spawned status of the NetworkObject. -To identify whether the local client is the owner of a NetworkObject, you can check the[`NetworkObject.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.IsOwner.html) or the [`NetworkBehaviour.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.IsOwner.html) property. +To identify whether the local client is the owner of a NetworkObject, you can check the[`NetworkObject.IsOwner`](xref:Unity.Netcode.NetworkObject.IsOwner) or the [`NetworkBehaviour.IsOwner`](xref:Unity.Netcode.NetworkBehaviour.IsOwner) property. -To identify whether the server owns a NetworkObject, you can check the [`NetworkObject.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.IsOwnedByServer.html) or the [`NetworkBehaviour.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.IsOwnedByServer.html) property. +To identify whether the server owns a NetworkObject, you can check the [`NetworkObject.IsOwnedByServer`](xref:Unity.Netcode.NetworkObject.IsOwnedByServer) or the [`NetworkBehaviour.IsOwnedByServer`](xref:Unity.Netcode.NetworkBehaviour.IsOwnedByServer) property. > [!NOTE] > To assure a spawned NetworkObject persists after the owner leaves a session, set the `NetworkObject.DontDestroyWithOwner` property to true. This assures the client-owned NetworkObject doesn't get destroyed when the owning client leaves. @@ -39,7 +39,7 @@ NetworkObject.SpawnWithOwnership(clientId); > [!NOTE] > Using `SpawnWithOwnership` can result in unexpected behavior when the spawning game client makes any other changes on the object immediately after spawning. -Using `SpawnWithOwnership` and then editing the NetworkObject locally means that the client doing the spawning will behave as the spawn authority. The spawn authority has limited local [authority](../terms-concepts/authority.md) over the NetworkObject, but not [ownership](../terms-concepts/ownership.md) of the NetworkObject that's spawned. This means any owner-specific checks during the spawn sequence will not be invoked on the spawn authority side. +Using `SpawnWithOwnership` and then editing the NetworkObject locally means that the client doing the spawning will behave as the spawn authority. The spawn authority has limited local [authority](../../terms-concepts/authority.md) over the NetworkObject, but not [ownership](../../terms-concepts/ownership.md) of the NetworkObject that's spawned. This means any owner-specific checks during the spawn sequence will not be invoked on the spawn authority side. If you want to spawn a NetworkObject for another client and then immediately make adjustments to that NetworkObject, it's recommended to use the `Spawn` method. After adjusting, the spawn authority can immediately follow with a call to `ChangeOwnership`. @@ -111,15 +111,15 @@ The authority of any NetworkObject can always change ownership, as outlined in [ ### Ownership permission settings -The following ownership permission settings, defined by [`NetworkObject.OwnershipStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipStatus.html), control how ownership of NetworkObjects can be changed during a distributed authority session: +The following ownership permission settings, defined by [`NetworkObject.OwnershipStatus`](xref:Unity.Netcode.NetworkObject.OwnershipStatus), control how ownership of NetworkObjects can be changed during a distributed authority session: |**Ownership setting**|Description|Related Property|Multi-select| |-----|-----|-----|-----| |`None`|Ownership of this NetworkObject can't be redistributed, requested, or transferred (a Player might have this, for example).||No| -|`Distributable`|Ownership of this NetworkObject is automatically redistributed when a client joins or leaves, as long as ownership is not locked or a request is pending.|[`IsOwnershipDistributable`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwnershipDistributable)|**Yes**| -|`Transferable`|Any client can change ownership of this NetworkObject at any time, as long as ownership is not locked or a request is pending.|[`IsOwnershipTransferable`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwnershipTransferable)|**Yes**| -|`RequestRequired`|Ownership of this NetworkObject must be requested before ownership can be changed.|[`IsOwnershipRequestRequired`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwnershipRequestRequired), [`IsRequestInProgress`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsRequestInProgress)|**Yes**| -|`SessionOwner`|This NetworkObject is always owned by the [session owner](distributed-authority.md#session-ownership) and can't be transferred or distributed. If the session owner changes, this NetworkObject is automatically transferred to the new session owner.|[`IsOwnershipSessionOwner`](Unity_Netcode_NetworkObject_IsOwnershipSessionOwner)|No| +|`Distributable`|Ownership of this NetworkObject is automatically redistributed when a client joins or leaves, as long as ownership is not locked or a request is pending.|[`IsOwnershipDistributable`](xref:Unity.Netcode.NetworkObject.IsOwnershipDistributable)|**Yes**| +|`Transferable`|Any client can change ownership of this NetworkObject at any time, as long as ownership is not locked or a request is pending.|[`IsOwnershipTransferable`](xref:Unity.Netcode.NetworkObject.IsOwnershipTransferable)|**Yes**| +|`RequestRequired`|Ownership of this NetworkObject must be requested before ownership can be changed.|[`IsOwnershipRequestRequired`](xref:Unity.Netcode.NetworkObject.IsOwnershipRequestRequired), [`IsRequestInProgress`](xref:Unity.Netcode.NetworkObject.IsRequestInProgress)|**Yes**| +|`SessionOwner`|This NetworkObject is always owned by the [session owner](../../terms-concepts/distributed-authority.md#session-ownership) and can't be transferred or distributed. If the session owner changes, this NetworkObject is automatically transferred to the new session owner.|[`IsOwnershipSessionOwner`](xref:Unity.Netcode.NetworkObject.IsOwnershipSessionOwner)|No| Ownership permissions can be set in the editor using the **Ownership** dropdown. @@ -127,7 +127,7 @@ Ownership permissions can be set in the editor using the **Ownership** dropdown. They can also be set in script using -You can also use `NetworkObject.SetOwnershipLock` to lock and unlock the permission settings of a NetworkObject for a period of time, preventing ownership changes on a temporary basis. The [`IsOwnershipLocked`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwnershipLocked) property can be used to detect if an object has locked ownership. +You can also use `NetworkObject.SetOwnershipLock` to lock and unlock the permission settings of a NetworkObject for a period of time, preventing ownership changes on a temporary basis. The [`IsOwnershipLocked`](xref:Unity.Netcode.NetworkObject.IsOwnershipLocked) property can be used to detect if an object has locked ownership. ```csharp // To lock an object from any ownership changes @@ -148,7 +148,7 @@ NetworkObject.ChangeOwnership(clientId); NetworkObject.ChangeOwnership(NetworkManager.LocalClientId); ``` -When a non-authoritative game client calls `ChangeOwnership`, the ownership change can fail. On a failed attempt to change ownership, the `OnOwnershipPermissionsFailure` callback will be invoked with a [`NetworkObject.OwnershipPermissionsFailureStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus.html) to give information on the failure. +When a non-authoritative game client calls `ChangeOwnership`, the ownership change can fail. On a failed attempt to change ownership, the `OnOwnershipPermissionsFailure` callback will be invoked with a [`NetworkObject.OwnershipPermissionsFailureStatus`](xref:Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus) to give information on the failure. ```csharp /* @@ -200,9 +200,9 @@ When a NetworkObject is set with `OwnershipPermissions.RequestRequired` any clie var requestStatus = NetworkObject.RequestOwnership(); ``` -`RequestOwnership` returns an [`OwnershipRequestStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestStatus.html) to indicate the initial status of the request. To view the result of the request, the `OnOwnershipRequestResponse` callback will be invoked with a [`NetworkObject.OwnershipRequestResponseStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus.html). +`RequestOwnership` returns an [`OwnershipRequestStatus`](xref:Unity.Netcode.NetworkObject.OwnershipRequestStatus) to indicate the initial status of the request. To view the result of the request, the `OnOwnershipRequestResponse` callback will be invoked with a [`NetworkObject.OwnershipRequestResponseStatus`](xref:Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus). -By default, any requests for ownership will automatically be approved. To control which client is approved for ownership, use the [`OnOwnershipRequested`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_OnOwnershipRequested) callback +By default, any requests for ownership will automatically be approved. To control which client is approved for ownership, use the [`OnOwnershipRequested`](xref:Unity.Netcode.NetworkObject.OnOwnershipRequested) callback ```csharp /* @@ -264,8 +264,8 @@ public class RequestableOwnershipBehaviour : NetworkBehaviour ## Additional resources -- [NetworkObject](../components/core/networkobject.md) +- [NetworkObject](./networkobject.md) - [NetworkBehaviour](./networkbehaviour.md) - [NetworkBehaviour ownership](./networkbehaviour-ownership.md) -- [Ownership](../terms-concepts/ownership.md) -- [Authority](../terms-concepts/authority.md) +- [Ownership](../../terms-concepts/ownership.md) +- [Authority](../../terms-concepts/authority.md) diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md b/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md index 56730e4c71..d722d58624 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md @@ -7,7 +7,7 @@ Netcode for GameObjects' high level components, [the RPC system](../../advanced- 1. NetworkObject 2. [NetworkBehaviour](networkbehaviour.md) -NetworkObjects require the use of specialized [`NetworkObjectReference`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObjectReference.html) structures before you can serialize and use them with RPCs and `NetworkVariable`s +NetworkObjects require the use of specialized [`NetworkObjectReference`](xref:Unity.Netcode.NetworkObjectReference) structures before you can serialize and use them with RPCs and `NetworkVariable`s Netcode for GameObjects also has [PlayerObjects](playerobjects.md), an optional feature that you can use to assign a NetworkObject to a specific client. @@ -65,7 +65,7 @@ Refer to the [NetworkSceneManager active scene synchronization](../../basics/sce ![image](../../images/SceneMigrationSynchronization.png) -Similar to [`NetworkObject.ActiveSceneSynchronization`](#active-scene-synchronization), [`NetworkObject.SceneMigrationSynchronization`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_SceneMigrationSynchronization) automatically synchronizes client-side NetworkObject instances that are migrated to a scene via [`SceneManager.MoveGameObjectToScene`](https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.MoveGameObjectToScene.html) on the host or server side. This can be useful if you have a specific scene you wish to migrate NetworkObject instances to that is not the currently active scene. +Similar to [`NetworkObject.ActiveSceneSynchronization`](#active-scene-synchronization), [`NetworkObject.SceneMigrationSynchronization`](xref:Unity.Netcode.NetworkObject.SceneMigrationSynchronization) automatically synchronizes client-side NetworkObject instances that are migrated to a scene via [`SceneManager.MoveGameObjectToScene`](https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.MoveGameObjectToScene.html) on the host or server side. This can be useful if you have a specific scene you wish to migrate NetworkObject instances to that is not the currently active scene. `NetworkObject.ActiveSceneSynchronization` can be used with `NetworkObject.SceneMigrationSynchronization` as long as you take into consideration that if you migrate a NetworkObject into a non-active scene via `SceneManager.MoveGameObjectToScene` and later change the active scene, then the NetworkObject instance will be automatically migrated to the newly set active scene. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/core/playerobjects.md b/com.unity.netcode.gameobjects/Documentation~/components/core/playerobjects.md index e7ae88353f..a679806c44 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/core/playerobjects.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/core/playerobjects.md @@ -53,14 +53,14 @@ In addition to the [session-mode agnostic spawning methods](#session-mode-agnost ### Distributed authority contexts only -In addition to the [session-mode agnostic spawning methods](#session-mode-agnostic-methods) above, you can use the [`OnFetchLocalPlayerPrefabToSpawn`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_OnFetchLocalPlayerPrefabToSpawn) method to assign a unique player prefab on a per-client basis when in [distributed authority contexts](../../terms-concepts/distributed-authority.md). +In addition to the [session-mode agnostic spawning methods](#session-mode-agnostic-methods) above, you can use the [`OnFetchLocalPlayerPrefabToSpawn`](xref:Unity.Netcode.NetworkManager.OnFetchLocalPlayerPrefabToSpawn) method to assign a unique player prefab on a per-client basis when in [distributed authority contexts](../../terms-concepts/distributed-authority.md). To use `OnFetchLocalPlayerPrefabToSpawn` in your project, assign a callback handler to `OnFetchLocalPlayerPrefabToSpawn` and whatever the client script returns is what will be spawned for that client. Ensure that the prefab being spawned is in a NetworkPrefabList [registered with the NetworkManager](../../basics/object-spawning.md#registering-a-network-prefab). If you don't assign a callback handler to `OnFetchLocalPlayerPrefabToSpawn`, then the default behavior is to return the `NetworkConfig.PlayerPrefab` (or null if neither are set). :::note `AutoSpawnPlayerPrefabClientSide` required -For `OnFetchLocalPlayerPrefabToSpawn` to work, [`AutoSpawnPlayerPrefabClientSide`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_AutoSpawnPlayerPrefabClientSide) must be enabled. +For `OnFetchLocalPlayerPrefabToSpawn` to work, [`AutoSpawnPlayerPrefabClientSide`](xref:Unity.Netcode.NetworkManager.AutoSpawnPlayerPrefabClientSide) must be enabled. ::: ## PlayerObject spawning timeline diff --git a/com.unity.netcode.gameobjects/Documentation~/components/helper/componentcontroller.md b/com.unity.netcode.gameobjects/Documentation~/components/helper/componentcontroller.md index 26465b9d6e..09136b095e 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/helper/componentcontroller.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/helper/componentcontroller.md @@ -1,6 +1,6 @@ # ComponentController -Use a [ComponentController](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.ComponentController.html) component to enable or disable one or more components depending on the authority state of the ComponentController and have those changes synchronized with non-authority instances. +Use a [ComponentController](xref:Unity.Netcode.ComponentController) component to enable or disable one or more components depending on the authority state of the ComponentController and have those changes synchronized with non-authority instances. For example, you can use a ComponentController to enable or disable a MeshRenderer component on the owner of the ComponentController instance, while disabling it for all other clients. This is useful for controlling visibility of objects that should only be visible to the owner, such as a player's avatar or a weapon they are holding. diff --git a/com.unity.netcode.gameobjects/Documentation~/components/helper/helpercomponents.md b/com.unity.netcode.gameobjects/Documentation~/components/helper/helpercomponents.md index 64df3f347b..d9515ebb47 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/helper/helpercomponents.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/helper/helpercomponents.md @@ -6,8 +6,8 @@ Understand the helper components available to use in your Netcode for GameObject | :------------------------------ | :------------------------------- | | **[AttachableBehaviour](attachablebehaviour.md)**| Use the AttachableBehaviour component to manage [ComponentController](componentcontroller.md) components and to attach a child GameObject to an [AttachableNode](attachablenode.md). The AttachableBehaviour component provides an alternative to NetworkObject parenting, allowing you to attach and detach child objects dynamically during runtime. | | **[AttachableNode](attachablenode.md)**| Use an AttachableNode component to provide an attachment point for an [AttachableBehaviour](attachablebehaviour.md) component. | -| **[ComponentController](componentcontroller.md)**| Use a [ComponentController](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.ComponentController.html) component to enable or disable one or more components depending on the authority state of the ComponentController and have those changes synchronized with non-authority instances. | +| **[ComponentController](componentcontroller.md)**| Use a [ComponentController](xref:Unity.Netcode.ComponentController) component to enable or disable one or more components depending on the authority state of the ComponentController and have those changes synchronized with non-authority instances. | | **[NetworkAnimator](networkanimator.md)**| The NetworkAnimator component provides you with a fundamental example of how to synchronize animations during a network session. Animation states are synchronized with players joining an existing network session and any client already connected before the animation state changing. | | **[NetworkRigidbody](networkrigidbody.md)**| NetworkRigidbody is a component that sets the Rigidbody of the GameObject into kinematic mode on all non-authoritative instances. | -| **[NetworkTransform](networktransform.md)**| [NetworkTransform](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Components.NetworkTransform.html) is a concrete class that inherits from [NetworkBehaviour](../core/networkbehaviour.md) and synchronizes [Transform](https://docs.unity3d.com/Manual/class-Transform.html) properties across the network, ensuring that the position, rotation, and scale of a [GameObject](https://docs.unity3d.com/Manual/working-with-gameobjects.html) are replicated to other clients. | +| **[NetworkTransform](networktransform.md)**| [NetworkTransform](xref:Unity.Netcode.Components.NetworkTransform) is a concrete class that inherits from [NetworkBehaviour](../core/networkbehaviour.md) and synchronizes [Transform](https://docs.unity3d.com/Manual/class-Transform.html) properties across the network, ensuring that the position, rotation, and scale of a [GameObject](https://docs.unity3d.com/Manual/working-with-gameobjects.html) are replicated to other clients. | | **[Physics](../../advanced-topics/physics.md)**| Netcode for GameObjects has a built in approach which allows for server-authoritative physics where the physics simulation only runs on the server. | diff --git a/com.unity.netcode.gameobjects/Documentation~/components/helper/networkrigidbody.md b/com.unity.netcode.gameobjects/Documentation~/components/helper/networkrigidbody.md index 8f412f7898..b931d59afb 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/helper/networkrigidbody.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/helper/networkrigidbody.md @@ -12,7 +12,7 @@ When looking at a NetworkRigidbody in the Inspector view, there are three expose - When enabled and using a [NetworkTransform](networktransform.md), the NetworkTransform uses the PhysX position and rotation to synchronize changes during the `FixedUpdate` loop update stage. - __Auto Update Kinematic State__ - When enabled, NetworkRigidbody automatically determines whether the current instance should be kinematic or non-kinematic. - - For custom solutions, you can opt to disable this field or derive from [NetworkRigidbodyBase](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.5/api/Unity.Netcode.Components.NetworkRigidbodyBase.html) and design your own custom networked Rigidbody handler. + - For custom solutions, you can opt to disable this field or derive from [NetworkRigidbodyBase](xref:Unity.Netcode.Components.NetworkRigidbodyBase) and design your own custom networked Rigidbody handler. - __Auto Set Kinematic On Despawn__ - When enabled, this option makes the rigid body kinematic when despawned (which can be useful for [object pools](../../advanced-topics/object-pooling.md)). @@ -25,7 +25,7 @@ Some collision events aren't fired when using NetworkRigidBody: - You can adjust the __Contact Pairs Mode__ to use kinematic and non-kinematic by setting it to __Enable All Contact Pairs__.![image](../../images/networktransform/ProjectPhysicsSettings2.png) > [!NOTE] -> If there's a need for a gameplay event to happen on a collision, you can listen to the `OnCollisionEnter` function on the server and synchronize the event via `Rpc(SendTo.Everyone)` to all clients. If you plan on handling many collisions, then it's recommended to use the [RigidbodyContactEventManager component](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Components.RigidbodyContactEventManager.html) to handle collision checking during a job (`OnCollisionenter` can become expensive from a processing perspective if you have enough instances colliding). +> If there's a need for a gameplay event to happen on a collision, you can listen to the `OnCollisionEnter` function on the server and synchronize the event via `Rpc(SendTo.Everyone)` to all clients. If you plan on handling many collisions, then it's recommended to use the [RigidbodyContactEventManager component](xref:Unity.Netcode.Components.RigidbodyContactEventManager) to handle collision checking during a job (`OnCollisionenter` can become expensive from a processing perspective if you have enough instances colliding). ### NetworkRigidbody2D diff --git a/com.unity.netcode.gameobjects/Documentation~/components/helper/networktransform.md b/com.unity.netcode.gameobjects/Documentation~/components/helper/networktransform.md index b77c930647..8db6f66114 100644 --- a/com.unity.netcode.gameobjects/Documentation~/components/helper/networktransform.md +++ b/com.unity.netcode.gameobjects/Documentation~/components/helper/networktransform.md @@ -1,6 +1,6 @@ # NetworkTransform -[NetworkTransform](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Components.NetworkTransform.html) is a concrete class that inherits from [NetworkBehaviour](../core/networkbehaviour.md) and synchronizes [Transform](https://docs.unity3d.com/Manual/class-Transform.html) properties across the network, ensuring that the position, rotation, and scale of a [GameObject](https://docs.unity3d.com/Manual/working-with-gameobjects.html) are replicated to other clients. +[NetworkTransform](xref:Unity.Netcode.Components.NetworkTransform) is a concrete class that inherits from [NetworkBehaviour](../core/networkbehaviour.md) and synchronizes [Transform](https://docs.unity3d.com/Manual/class-Transform.html) properties across the network, ensuring that the position, rotation, and scale of a [GameObject](https://docs.unity3d.com/Manual/working-with-gameobjects.html) are replicated to other clients. The synchronization of a GameObject's Transform is a key netcode task, and usually proceeds in the following order: @@ -39,7 +39,7 @@ Theoretically, you can have a NetworkTransform on every child object of a 100 le When nesting NetworkTransforms, you should first determine if there are any alternative approaches to handling child object motion (such as synchronizing through animations or using an algorithm that uses the synchronized network time) to ensure you're not consuming unnecessary processing time and bandwidth. -For example, if you use a [NetworkAnimator](networkanimator.md) component to synchronize animations (instead of nested NetworkTransforms), then you don't need to manage synchronizing each child node of the model because the animation system and NetworkAnimator handle it for you. Similarly, if you want a child object to orbit its parent object, you can use the server time ([`NetworkManager.ServerTime`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?sufolder=/api/Unity.Netcode.NetworkManager.html#Unity_Netcode_NetworkManager_ServerTime)) to feed into an algorithm that's used on all instances (local and remote). This removes the need to synchronize motion between child and parent because the algorithm is driven by a value that's already being synchronized on all clients. +For example, if you use a [NetworkAnimator](networkanimator.md) component to synchronize animations (instead of nested NetworkTransforms), then you don't need to manage synchronizing each child node of the model because the animation system and NetworkAnimator handle it for you. Similarly, if you want a child object to orbit its parent object, you can use the server time ([`NetworkManager.ServerTime`](xref:Unity.Netcode.NetworkManager.ServerTime)) to feed into an algorithm that's used on all instances (local and remote). This removes the need to synchronize motion between child and parent because the algorithm is driven by a value that's already being synchronized on all clients. > [!NOTE] > Generally, unless you have some unique motion that needs to be applied to a child object and it can't be synchronized through an animation or an algorithm based on a synchronized value, then you shouldn't nest NetworkTransforms. However, nesting NetworkTransforms is more optimal then creating multiple individual single-node network prefabs with NetworkTransforms and parenting those once they're spawned. @@ -58,13 +58,13 @@ Some NetworkTransform properties are automatically synchronized by the authorita The following are a list of NetworkTransform properties that will cause a full state update (effectively a teleport) when changed during runtime by the authority instance: -- [UseUnreliableDeltas](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_UseUnreliableDeltas) -- [InLocalSpace](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_InLocalSpace) -- [Interpolate](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_Interpolate) -- [SlerpPosition](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_SlerpPosition) -- [UseQuaternionSynchronization](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_UseQuaternionSynchronization) -- [UseQuaternionCompression](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_UseQuaternionCompression) -- [UseHalfFloatPrecision](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.3/api/Unity.Netcode.Components.NetworkTransform.html#Unity_Netcode_Components_NetworkTransform_UseHalfFloatPrecision) +- [UseUnreliableDeltas](xref:Unity.Netcode.Components.NetworkTransform.UseUnreliableDeltas) +- [InLocalSpace](xref:Unity.Netcode.Components.NetworkTransform.InLocalSpace) +- [Interpolate](xref:Unity.Netcode.Components.NetworkTransform.Interpolate) +- [SlerpPosition](xref:Unity.Netcode.Components.NetworkTransform.SlerpPosition) +- [UseQuaternionSynchronization](xref:Unity.Netcode.Components.NetworkTransform.UseQuaternionSynchronization) +- [UseQuaternionCompression](xref:Unity.Netcode.Components.NetworkTransform.UseQuaternionCompression) +- [UseHalfFloatPrecision](xref:Unity.Netcode.Components.NetworkTransform.UseHalfFloatPrecision) The following NetworkTransform properties can cause a full state update when changed during runtime by the authority instance: diff --git a/com.unity.netcode.gameobjects/Documentation~/install.md b/com.unity.netcode.gameobjects/Documentation~/install.md index 9fb1b54ef6..c3e5b597ec 100644 --- a/com.unity.netcode.gameobjects/Documentation~/install.md +++ b/com.unity.netcode.gameobjects/Documentation~/install.md @@ -7,7 +7,7 @@ Follow the instructions on this page to set up Netcode for GameObjects in your U Before you begin, you need the following: - An active Unity account with a valid license. -- A supported version of Unity. Check [Netcode for GameObjects' requirements](#netcode-installation-requirements) for the specific version details. +- A supported version of Unity. Check [Netcode for GameObjects' requirements](#compatibility) for the specific version details. - An existing Unity project. If you're new to Unity, you can refer to the [get started](./tutorials/get-started-with-ngo.md) section for guidance. ### Compatibility diff --git a/com.unity.netcode.gameobjects/Documentation~/learn/dealing-with-latency.md b/com.unity.netcode.gameobjects/Documentation~/learn/dealing-with-latency.md index a14cc6d0da..e1c5b056ca 100644 --- a/com.unity.netcode.gameobjects/Documentation~/learn/dealing-with-latency.md +++ b/com.unity.netcode.gameobjects/Documentation~/learn/dealing-with-latency.md @@ -52,7 +52,7 @@ Note here an input from a client can be anything, from a user interacting with a #### Issue: Reactivity -An issue with server authority is you're waiting for your server to tell you to update your world. This means that if you send an input to the server and wait for the server to tell you your position change, you'll need to wait for a full **RTT** before you see the effect. There are [patterns](#patterns-to-solve-these-issues) you can use to solve this issue while still remaining server authoritative. +An issue with server authority is you're waiting for your server to tell you to update your world. This means that if you send an input to the server and wait for the server to tell you your position change, you'll need to wait for a full **RTT** before you see the effect. There are [patterns](#patterns-to-solve-latency-issues-in-a-server-authoritative-game) you can use to solve this issue while still remaining server authoritative. ### Client authority @@ -82,7 +82,7 @@ To avoid this, it's recommended to use client **owner** authority, which allows Client authority is a pretty dangerous door to leave open on your server because any malicious player can forge messages to say "kill player a, b, c, d, e, f, g" and win the game. It's pretty useful though for reactivity. Since the client is making all the important gameplay decisions, it can display the result of user inputs as soon as they happen instead of waiting a few hundred milliseconds. -When you don't think there's any reason for your players to cheat, client authority can be a great way to have reactivity without the complexity added with techniques like [input prediction](#prediction). +When you don't think there's any reason for your players to cheat, client authority can be a great way to have reactivity without the complexity added with techniques like [input prediction](#client-side-prediction). Another way of solving this issue in a client authoritative game is using soft validation server side. Instead of doing all simulation server side, the server only does basic validation. The server would, for example, do range checks to make sure a player isn't teleporting to places it shouldn't. Doing so is acceptable for most [PvE](https://en.wikipedia.org/wiki/Player_versus_environment) games. However, [PvP](https://en.wikipedia.org/wiki/Player_versus_player) games usually require server authority. @@ -157,7 +157,7 @@ To do continuous client driven actions, there's a few more considerations to tak - You then need to make sure you don't send RPCs to the server (containing your authoritative state) when no data has changed and do dirty checks. - You'd need to send it on tick or at worst on FixedUpdate. Sending on Update() would spam your connection. -A sample for a [ClientNetworkTransform](../components/helper/networktransform.md#clientnetworktransform) has been created, so you don't have to reimplement this yourself for transform updates. A [sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/ClientDriven) has been created on how to use it. See [movement script](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/blob/v1.2.1/Basic/ClientDriven/Assets/Scripts/ClientPlayerMove.cs). +A sample for a [ClientNetworkTransform](../components/helper/networktransform.md#client-vs-server-authority) has been created, so you don't have to reimplement this yourself for transform updates. A [sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/ClientDriven) has been created on how to use it. See [movement script](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/blob/v1.2.1/Basic/ClientDriven/Assets/Scripts/ClientPlayerMove.cs). > [!NOTE] > A rule of thumb here is to ask yourself: "Can the server correct me on this?". If it can, use server authority. diff --git a/com.unity.netcode.gameobjects/Documentation~/learn/listenserverhostarchitecture.md b/com.unity.netcode.gameobjects/Documentation~/learn/listenserverhostarchitecture.md index e32e3858c8..d85764142b 100644 --- a/com.unity.netcode.gameobjects/Documentation~/learn/listenserverhostarchitecture.md +++ b/com.unity.netcode.gameobjects/Documentation~/learn/listenserverhostarchitecture.md @@ -33,7 +33,7 @@ In contrast to dedicated servers, listen servers are cheaper without the need to ## Connecting to a listen server -Personal computers are hidden behind NATs (Network Address Translation devices) and routers to protect them from direct access. To connect to a listen server, you may choose an option such as [port forwarding](#port-forwarding), a [relay server](#relay-server), [NAT punch-through](#nat-punchthrough), or a [NAT punch with relay fallback](#nat-punch-and-relay-fallback). +Personal computers are hidden behind NATs (Network Address Translation devices) and routers to protect them from direct access. To connect to a listen server, you may choose an option such as [port forwarding](#port-forwarding), a [relay server](#relay-server), [NAT punch-through](#nat-punch-through), or a [NAT punch with relay fallback](#nat-punch-and-relay-fallback). ### Port Forwarding diff --git a/com.unity.netcode.gameobjects/Documentation~/learn/rpcvnetvar.md b/com.unity.netcode.gameobjects/Documentation~/learn/rpcvnetvar.md index 0713cbab28..3d31914ddb 100644 --- a/com.unity.netcode.gameobjects/Documentation~/learn/rpcvnetvar.md +++ b/com.unity.netcode.gameobjects/Documentation~/learn/rpcvnetvar.md @@ -1,7 +1,7 @@ # RPC vs NetworkVariable Choosing the wrong data syncing mechanism can create bugs, use too much bandwidth, and add too much complexity to your code. -Netcode for GameObjects (Netcode) has two main ways of syncing information between players: RPCs ([Remote Procedure Calls](../advanced-topics/messaging-system.md)) and replicated states [(`NetworkVariable`s)](../basics/networkvariable). They both send messages over the network. The logic and your design around how they send messages is what will make you choose one over the other. +Netcode for GameObjects (Netcode) has two main ways of syncing information between players: RPCs ([Remote Procedure Calls](../advanced-topics/messaging-system.md)) and replicated states [(`NetworkVariable`s)](../basics/networkvariable.md). They both send messages over the network. The logic and your design around how they send messages is what will make you choose one over the other. ## Choosing between `NetworkVariable`s or RPCs diff --git a/com.unity.netcode.gameobjects/Documentation~/learn/ticks-and-update-rates.md b/com.unity.netcode.gameobjects/Documentation~/learn/ticks-and-update-rates.md index 2ab45e73c2..dac2bc523a 100644 --- a/com.unity.netcode.gameobjects/Documentation~/learn/ticks-and-update-rates.md +++ b/com.unity.netcode.gameobjects/Documentation~/learn/ticks-and-update-rates.md @@ -16,7 +16,7 @@ When a server fails to process all incoming client data before the end of the cu Update rate is a measure of how frequently the client sends and receives data to and from the server. It's also measured in hertz and, like tick rate, a higher update rate results in a more responsive game at the cost of increased processing and network demands on the client and server. -![](../../images/update-rates-light.png) +![](../images/update-rates-light.png) In addition to adding to perceived latency, low update rates can cause their own issues, such as multiple updates being bundled together and arriving at the same time, causing undesirable behavior. @@ -24,7 +24,7 @@ In the example of 'super bullets': if an in-game gun is capable of shooting more The diagram below illustrates the difference between a 10 Hz update rate and a 60 Hz update rate. With a 10 Hz update rate, the game sends updates to the server ten times a second, so a gun that can fire 600 rounds per minute (RPM), or ten times a second, will only ever send a single bullet per update. A gun that fires at 750 RPM, more than ten times a second, will end up running into the super bullet problem. A higher update rate of 60 Hz resolves this issue, ensuring that there are enough updates for each bullet to arrive separately in its own update. -![](../../images/rpm_update_rates-light.png) +![](../images/rpm_update_rates-light.png) ### Discrepancy between tick rate and update rate diff --git a/com.unity.netcode.gameobjects/Documentation~/migratingfromUNet.md b/com.unity.netcode.gameobjects/Documentation~/migratingfromUNet.md index ee35801235..8d58a3366d 100644 --- a/com.unity.netcode.gameobjects/Documentation~/migratingfromUNet.md +++ b/com.unity.netcode.gameobjects/Documentation~/migratingfromUNet.md @@ -115,7 +115,7 @@ public class MyNetcodeExample : NetworkBehaviour } ``` -Refer to [NetworkBehaviour](basics/networkbehaviour.md) for more information. +Refer to [NetworkBehaviour](components/core/networkbehaviour.md) for more information. ## Replace SyncVar @@ -343,7 +343,7 @@ Refer to [Object Spawning](basics/object-spawning.md) for more information. ## Custom Spawn Handlers -Netcode has `Custom Spawn Handlers` to replace UNet's `Custom Spawn Functions`. See [Object Pooling](../advanced-topics/object-pooling) for more information. +Netcode has `Custom Spawn Handlers` to replace UNet's `Custom Spawn Functions`. See [Object Pooling](advanced-topics/object-pooling.md) for more information. ## Replace `NetworkContextProperties` diff --git a/com.unity.netcode.gameobjects/Documentation~/networkbehaviour-landing.md b/com.unity.netcode.gameobjects/Documentation~/networkbehaviour-landing.md index c690759906..8d1cbeac17 100644 --- a/com.unity.netcode.gameobjects/Documentation~/networkbehaviour-landing.md +++ b/com.unity.netcode.gameobjects/Documentation~/networkbehaviour-landing.md @@ -5,5 +5,5 @@ Understand how to use NetworkBehaviour components in your project. | **Topic** | **Description** | | :------------------------------ | :------------------------------- | -| **[NetworkBehaviour](components/core/networkbehaviour.md)** | [NetworkBehaviour](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](components/core/networkobject.md) component and at least one NetworkBehaviour component. | +| **[NetworkBehaviour](components/core/networkbehaviour.md)** | [NetworkBehaviour](xref:Unity.Netcode.NetworkBehaviour) is an abstract class that derives from [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) and is primarily used to create unique netcode or game logic. To replicate any netcode-aware properties or send and receive RPCs, a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) must have a [NetworkObject](components/core/networkobject.md) component and at least one NetworkBehaviour component. | | **[Synchronize](components/core/networkbehaviour-synchronize.md)** | You can use NetworkBehaviours to synchronize settings before, during, and after spawning NetworkObjects. | \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Documentation~/removed-tableofcontents.md b/com.unity.netcode.gameobjects/Documentation~/removed-tableofcontents.md index e9eadb4428..224e9f2f47 100644 --- a/com.unity.netcode.gameobjects/Documentation~/removed-tableofcontents.md +++ b/com.unity.netcode.gameobjects/Documentation~/removed-tableofcontents.md @@ -10,7 +10,7 @@ * [Bitesize introduction](samples/bitesize/bitesize-introduction.md) * [Bitesize space shooter](samples/bitesize/bitesize-spaceshooter.md) * [Bitesize client driven](samples/bitesize/bitesize-clientdriven.md) - * [Bitesize dynamic prefabs](samples/bitesize/bitesize-dynamicPrefabs.md) + * [Bitesize dynamic prefabs](samples/bitesize/bitesize-dynamicprefabs.md) * [Bitesize social hub](samples/bitesize/bitesize-socialhub.md) --> \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-landing.md b/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-landing.md index 880fbb821e..1009a7343e 100644 --- a/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-landing.md +++ b/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-landing.md @@ -8,5 +8,5 @@ The Bite Size samples are small, focused examples that demonstrate specific feat | **[Bitesize introduction](bitesize-introduction.md)** | The Bitesize Samples repository provides a series of sample code as modules to use in your games and better understand Netcode for GameObjects. | | **[Bitesize space shooter](bitesize-spaceshooter.md)** | Learn more about physics movement and status effects using Netcode for GameObjects (Netcode) NetworkVariables and ObjectPooling. | | **[Bitesize client driven](bitesize-clientdriven.md)** | Learn more about Client driven movements, networked physics, spawning vs statically placed objects, object reparenting. | -| **[Bitesize dynamic prefabs](bitesize-dynamicPrefabs.md)** | Learn more about the dynamic Prefab system, which allows you to add new spawnable Prefabs at runtime. | +| **[Bitesize dynamic prefabs](bitesize-dynamicprefabs.md)** | Learn more about the dynamic Prefab system, which allows you to add new spawnable Prefabs at runtime. | | **[Bitesize social hub](bitesize-socialhub.md)** | The Distributed Authority Social Hub Sample is a project that demonstrates Distributed Authority's features and helps you integrate Distributed Authority into your own game projects. | \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-usecases.md b/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-usecases.md index ebdbfc5705..a41c3d1238 100644 --- a/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-usecases.md +++ b/com.unity.netcode.gameobjects/Documentation~/samples/bitesize/bitesize-usecases.md @@ -16,11 +16,11 @@ The tutorials that open with each scene use the [Tutorial Framework package](htt ## The Anticipation scene The Anticipation scene demonstrates the Client Anticipation feature of Netcode for GameObjects in the following use cases: -- [`AnticipatedNetworkVariable`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.2/api/Unity.Netcode.AnticipatedNetworkVariable-1.html): +- [`AnticipatedNetworkVariable`](xref:Unity.Netcode.AnticipatedNetworkVariable%601): - Anticipate server actions based on player interaction to change NetworkVariables responsively. - Compensate for latency that the server causes when it changes a value. - Handle incorrect anticipation. -- [`AnticipatedNetworkTransform`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.2/api/Unity.Netcode.Components.AnticipatedNetworkTransform.html): +- [`AnticipatedNetworkTransform`](xref:Unity.Netcode.Components.AnticipatedNetworkTransform): - Responsive server-authoritative player movement. - Smooth player movement across clients. diff --git a/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/getting-started-boss-room.md b/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/getting-started-boss-room.md index 096d7f72db..214a8fdae5 100644 --- a/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/getting-started-boss-room.md +++ b/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/getting-started-boss-room.md @@ -25,8 +25,8 @@ Join the multiplayer community on the Unity [Discord](https://discord.gg/mNgM2XR ### Contents and quick links - [Boss Room Overview](#boss-room-overview) -- [Install the Boss Room project](#getting-the-project) - - [Install Git LFS to clone locally](#installing-git-lfs-to-clone-locally) +- [Install the Boss Room project](#install-the-boss-room-project) + - [Install Git LFS to clone locally](#install-git-lfs-to-clone-locally) - [Direct download](#direct-download) - [Registering the project with Unity Gaming Services (UGS)](#registering-the-project-with-unity-gaming-services-ugs) - [Opening the project for the first time](#opening-the-project-for-the-first-time) diff --git a/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/optimizing-bossroom.md b/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/optimizing-bossroom.md index 234830e4c0..ddde94a432 100644 --- a/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/optimizing-bossroom.md +++ b/com.unity.netcode.gameobjects/Documentation~/samples/bossroom/optimizing-bossroom.md @@ -73,19 +73,19 @@ The Boss Room sample shows how to adapt some Unity Transport properties to fit i ### Disconnect Timeout {#disconnect-timeout} -The [Disconnect Timeout property](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Transports.UTP.UnityTransport.html#Unity_Netcode_Transports_UTP_UnityTransport_DisconnectTimeoutMS) controls how long the server (and the clients) wait before disconnecting. The Boss Room sample uses a Disconnect Timeout value of 10 seconds to prevent the server and the clients from hanging onto a connection for too long. +The [Disconnect Timeout property](xref:Unity.Netcode.Transports.UTP.UnityTransport.DisconnectTimeoutMS) controls how long the server (and the clients) wait before disconnecting. The Boss Room sample uses a Disconnect Timeout value of 10 seconds to prevent the server and the clients from hanging onto a connection for too long. ### Max Connect Attempts {#max-connect-attempts} -The [Max Connect Attempts property](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Transports.UTP.UnityTransport.html#Unity_Netcode_Transports_UTP_UnityTransport_MaxConnectAttempts) controls the times a client tries to connect before declaring a connection failure. The Boss Room sample uses a Max Connect Attempts value of 10 to prevent clients from waiting too long before declaring a connection failure. +The [Max Connect Attempts property](xref:Unity.Netcode.Transports.UTP.UnityTransport.MaxConnectAttempts) controls the times a client tries to connect before declaring a connection failure. The Boss Room sample uses a Max Connect Attempts value of 10 to prevent clients from waiting too long before declaring a connection failure. ### Connect Timeout {#connect-timeout} -The [Connect Timeout property](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Transports.UTP.UnityTransport.html#Unity_Netcode_Transports_UTP_UnityTransport_ConnectTimeoutMS) controls the number of times clients attempt to connect per second. The Boss Room sample uses a Connect Timeout value of 1 second, meaning that clients try to connect once per second. Having the Connect Timeout set to 1 second and the Max Connect Attempts set to 10 means that clients fail to connect after 10 seconds of waiting. +The [Connect Timeout property](xref:Unity.Netcode.Transports.UTP.UnityTransport.ConnectTimeoutMS) controls the number of times clients attempt to connect per second. The Boss Room sample uses a Connect Timeout value of 1 second, meaning that clients try to connect once per second. Having the Connect Timeout set to 1 second and the Max Connect Attempts set to 10 means that clients fail to connect after 10 seconds of waiting. ### Max Packet Queue Size {#max-packet-queue-size} -The [Max Packet Queue Size property](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.Transports.UTP.UnityTransport.html#Unity_Netcode_Transports_UTP_UnityTransport_MaxPacketQueueSize) defines the maximum number of packets that can be sent and received during a single frame. +The [Max Packet Queue Size property](xref:Unity.Netcode.Transports.UTP.UnityTransport.MaxPacketQueueSize) defines the maximum number of packets that can be sent and received during a single frame. The impact of surpassing the Max Packet Queue Size threshold varies depending on the packet direction (sending or receiving). diff --git a/com.unity.netcode.gameobjects/Documentation~/serialization.md b/com.unity.netcode.gameobjects/Documentation~/serialization.md index 4dfd16f484..51aee596eb 100644 --- a/com.unity.netcode.gameobjects/Documentation~/serialization.md +++ b/com.unity.netcode.gameobjects/Documentation~/serialization.md @@ -14,4 +14,4 @@ Netcode for GameObjects has built-in serialization support for C# and Unity prim | **[Custom serialization](advanced-topics/custom-serialization.md)** | Create custom serialization types. | | **[NetworkObject serialization](advanced-topics/serialization/networkobject-serialization.md)** | `GameObjects`, `NetworkObjects` and NetworkBehaviour aren't serializable types so they can't be used in `RPCs` or `NetworkVariables` by default. There are two convenience wrappers which can be used to send a reference to a NetworkObject or a NetworkBehaviour over RPCs or `NetworkVariables`. | | **[FastBufferWriter and FastBufferReader](advanced-topics/fastbufferwriter-fastbufferreader.md)** | The serialization and deserialization is done via `FastBufferWriter` and `FastBufferReader`. These have methods for serializing individual types and methods for serializing packed numbers, but in particular provide a high-performance method called `WriteValue()/ReadValue()` (for Writers and Readers, respectively) that can extremely quickly write an entire unmanaged struct to a buffer. | -| **[BufferSerializer](advanced-topics/bufferserializer.md)** | A bi-directional serializer primarily used for serializing within [`INetworkSerializable`](serialization/inetworkserializable.md) types. | +| **[BufferSerializer](advanced-topics/bufferserializer.md)** | A bi-directional serializer primarily used for serializing within [`INetworkSerializable`](advanced-topics/serialization/inetworkserializable.md) types. | diff --git a/com.unity.netcode.gameobjects/Documentation~/terms-concepts/distributed-authority.md b/com.unity.netcode.gameobjects/Documentation~/terms-concepts/distributed-authority.md index 74f49a39c8..17c1f8b77b 100644 --- a/com.unity.netcode.gameobjects/Documentation~/terms-concepts/distributed-authority.md +++ b/com.unity.netcode.gameobjects/Documentation~/terms-concepts/distributed-authority.md @@ -53,7 +53,7 @@ You can use this property to conditionally execute logic that should only run on ### Session owner NetworkObjects -For game systems that should always be [owned](./ownership.md) by the session owner, you can set the NetworkObject to have the `OwnershipStatus.SessionOwner` [ownership permission](../advanced-topics/networkobject-ownership.md). This ensures that the NetworkObject always belongs to the current session owner. If that session owner disconnects or leaves the game, the ownership of that NetworkObject will be automatically moved to the newly selected session owner. +For game systems that should always be [owned](./ownership.md) by the session owner, you can set the NetworkObject to have the `OwnershipStatus.SessionOwner` [ownership permission](../components/core/networkobject-ownership.md). This ensures that the NetworkObject always belongs to the current session owner. If that session owner disconnects or leaves the game, the ownership of that NetworkObject will be automatically moved to the newly selected session owner. ## NetworkObject distribution diff --git a/com.unity.netcode.gameobjects/Documentation~/terms-concepts/ownership.md b/com.unity.netcode.gameobjects/Documentation~/terms-concepts/ownership.md index 3d47f69024..56ff42526e 100644 --- a/com.unity.netcode.gameobjects/Documentation~/terms-concepts/ownership.md +++ b/com.unity.netcode.gameobjects/Documentation~/terms-concepts/ownership.md @@ -35,7 +35,7 @@ In [distributed authority](./distributed-authority.md) the owner of a NetworkObj ![diagram showing ownership precedes authority](../images/diagrams/distributedAuthorityOwnership.png) -When building your game you can use [ownership permissions](../advanced-topics/networkobject-ownership.md#ownership-permission-settings) to control how and when ownership of NetworkObjects can be transferred between clients. +When building your game you can use [ownership permissions](../components/core/networkobject-ownership.md#ownership-permission-settings) to control how and when ownership of NetworkObjects can be transferred between clients. NetworkObjects with the `OwnershipStatus.Distributable` permission will have their ownership automatically distributed between all connected game clients whenever a new client joins or an existing client leaves. This is the key mechanism in how the game simulation is distributed between clients in a distributed authority session. @@ -48,4 +48,4 @@ The `IsOwner` property, which is available on both NetworkObjects and NetworkBeh * [Authority](authority.md) * [Client-server](client-server.md) * [Distributed authority](distributed-authority.md) -* [NetworkObject ownership](../advanced-topics/networkobject-ownership.md) +* [NetworkObject ownership](../components/core/networkobject-ownership.md) diff --git a/com.unity.netcode.gameobjects/Documentation~/tutorials/get-started-with-ngo.md b/com.unity.netcode.gameobjects/Documentation~/tutorials/get-started-with-ngo.md index 4a80b3fd1a..bbd635c497 100644 --- a/com.unity.netcode.gameobjects/Documentation~/tutorials/get-started-with-ngo.md +++ b/com.unity.netcode.gameobjects/Documentation~/tutorials/get-started-with-ngo.md @@ -33,7 +33,7 @@ This section guides you through adding the essential components of a networked g - [A NetworkManager component](#create-the-networkmanager-component) - [A player object](#create-an-object-to-spawn-for-each-connected-player) -- [A scene](#add-your-scene-to-the-build) +- [A scene](#scene-management-and-the-scenes-in-build-list) ### Create the NetworkManager component @@ -68,7 +68,7 @@ First, create the NetworkManager component: ### Create an object to spawn for each connected player > [!NOTE] -> When you drop the prefab into the **PlayerPrefab** slot, you're telling the library that when a client connects to the game, it automatically spawns this prefab as the character for the connecting client. Netcode for GameObjects won't spawn a player object if you don't have any prefab set as the **PlayerPrefab**. Refer to [Player Objects](../components/core/networkobject.md#finding-playerobjects). +> When you drop the prefab into the **PlayerPrefab** slot, you're telling the library that when a client connects to the game, it automatically spawns this prefab as the character for the connecting client. Netcode for GameObjects won't spawn a player object if you don't have any prefab set as the **PlayerPrefab**. Refer to [Player Objects](../components/core/playerobjects.md#finding-playerobjects). This section guides you through creating an object that spawns for each connected player. @@ -111,7 +111,7 @@ Netcode for GameObjects comes with an integrated scene management solution that Now that you have a **NetworkManager**, assigned a **PlayerPrefab**, and added your current scene to the scenes in build test, you can quickly verify everything is functioning/configured correctly via entering play mode in the Unity Editor. By starting a host, you are starting NetworkManager as both a server and a client at the same time. -You can test your Hello World project using the Unity Editor or a command-line helper. If you choose the latter, refer to [Create a command line helper](../tutorials/command-line-helper/). Otherwise, refer to the following instructions to test using the Unity Editor. Only the Plane appears on the server until the first client connects. Then, Netcode for GameObjects spawns a new Player prefab for each connected client; however, they overlap in the Game view. +You can test your Hello World project using the Unity Editor or a command-line helper. If you choose the latter, refer to [Create a command line helper](command-line-helper.md). Otherwise, refer to the following instructions to test using the Unity Editor. Only the Plane appears on the server until the first client connects. Then, Netcode for GameObjects spawns a new Player prefab for each connected client; however, they overlap in the Game view. 1. Select **Play** from the top of the Unity Editor to start the scene. @@ -119,7 +119,7 @@ You can test your Hello World project using the Unity Editor or a command-line h 2. Select **NetworkManager** from the **Hierarchy** list. -![](\img\get-started-ngo\ngo-2.png) +![](../images/get-started-ngo/ngo-2.png) 3. With **NetworkManager** selected (in the Hierarchy tab), select **Start Host** from the **Inspector** tab. Alternatively, you can use the in-game GUI buttons. @@ -239,7 +239,7 @@ The `HelloWorldManager.cs` script accomplishes this menu within the `StartButton As seen in the earlier code snippet, the `HelloWorldManager.cs` script also uses the NetworkManager's instance via its singleton to grab properties like the `IsClient`, `IsServer`, and `IsLocalClient`. The `IsClient` and `IsServer` properties dictate the established connection state. -The `HelloWorldManager.cs` script also introduces a new method called `SubmitNewPosition()` that the `HelloWorldPlayer` script uses to [create a simple RPC call](#add-simple-rpc-use). +The `HelloWorldManager.cs` script also introduces a new method called `SubmitNewPosition()` that the `HelloWorldPlayer` script uses to [create a simple RPC call](#adding-rpcs-remote-procedure-calls). ## Adding RPCs (Remote Procedure Calls) diff --git a/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/techniques_and_tricks_for_debugging_multiplayer_games.md b/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/techniques_and_tricks_for_debugging_multiplayer_games.md index aadbec86b8..6f5bbcd88d 100644 --- a/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/techniques_and_tricks_for_debugging_multiplayer_games.md +++ b/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/techniques_and_tricks_for_debugging_multiplayer_games.md @@ -10,7 +10,7 @@ Below is a list of practices and techniques that we use daily when working on th ### Use ParrelSync clone-based workflow during development. -[ParrelSync workflow](testing_locally.md#parrelsync) is faster than creating builds and it allows you to debug the separate editor instances via separate IDE debuggers. +[ParrelSync workflow](testing_with_artificial_conditions.md#clone-based-workflow-parrelsync) is faster than creating builds and it allows you to debug the separate editor instances via separate IDE debuggers. Use ParrelSync to run separate editor instances for your Host/Server and Client. @@ -22,7 +22,7 @@ Unity engine has two debug rendering APIs that are useful for the purposes of mu Both of these functions allow us to draw arbitrary debug lines that would be visible in the Scene view and in the Game view, provided Gizmo rendering is enabled (to enable Gizmo rendering in Game view you need to click on the `Gizmos` menu at the top of the Game view). -The key trick here is to use different colors for different kinds of information and to make the lines stay long enough for visual inspection by setting `duration` parameter. This technique shines when it's combined with [screen recordings](#7-recording-the-video-of-gameplay) of [multiple peers running side by side in separate editor instances via ParrelSync](#1-use-parrelsync-workflow-during-development). +The key trick here is to use different colors for different kinds of information and to make the lines stay long enough for visual inspection by setting `duration` parameter. This technique shines when it's combined with [screen recordings](#capturing-screen-recordings-of-the-game-instances) of [multiple peers running side by side in separate editor instances via ParrelSync](#use-parrelsync-clone-based-workflow-during-development). The code below would render a green debug line that's 2 units tall at the position of the transform, and this line would stay on screen for 4 seconds: `Debug.DrawLine(this.transform.position, this.transform.position + Vector3.UP * 2f, Color.green, duration: 4f);` diff --git a/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/testing_with_artificial_conditions.md b/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/testing_with_artificial_conditions.md index f3c0646638..634f84288a 100644 --- a/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/testing_with_artificial_conditions.md +++ b/com.unity.netcode.gameobjects/Documentation~/tutorials/testing/testing_with_artificial_conditions.md @@ -11,11 +11,11 @@ This is challenging when we are [iterating on our game locally](testing_locally. Thankfully there are a number of tools that can simulate adverse network conditions. -For testing locally within the Editor, you can use the [Network Simulator tool](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/) along with [clone-based workflow via ParrelSync](testing_locally.md#parrelsync). +For testing locally within the Editor, you can use the [Network Simulator tool](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/) along with [clone-based workflow via ParrelSync](#clone-based-workflow-parrelsync). For testing development builds with built-in artificial latency we suggest using [Network Simulator tools with some custom code to inject artificial conditions into the build](#debug-builds). -For testing release builds we suggest using [Clumsy](#clumsy-windows) if you're on Windows and Network Link Conditioner if you're on [macOS](#network-link-conditioner-mac-os) or [iOS](#network-link-conditioner-ios). A scriptable alternative to Network Link Conditioner on macOS is [dummynet](#dummynet-dnctl-and-pftcl-mac-os), which offers great control and comes packaged with the operating system. +For testing release builds we suggest using [Clumsy](#clumsy-windows) if you're on Windows and Network Link Conditioner if you're on [macOS](#network-link-conditioner-macos) or [iOS](#network-link-conditioner-ios). A scriptable alternative to Network Link Conditioner on macOS is [dummynet](#dummynet-dnctl-and-pftcl-macos), which offers great control and comes packaged with the operating system. > [!NOTE] > While artificial latency is great for simulating network conditions during development - it won't accurately emulate real world conditions. We recommend to test your game often on the targeted platforms and real live networking conditions. @@ -49,7 +49,7 @@ Adding packet loss, apart from introducing even more effective delay to our syst ### Different network conditions for different peers -[Clumsy](#clumsy-on-windows), [Network Link Conditioner](#network-link-conditioner-mac-os) and [dummynet](#dummynet-dnctl-and-pftcl-mac-os) are introducing changes on OS level, thus all the instances of the game that we open on our local machine would run under the same network conditions. +[Clumsy](#clumsy-windows), [Network Link Conditioner](#network-link-conditioner-macos) and [dummynet](#dummynet-dnctl-and-pftcl-macos) are introducing changes on OS level, thus all the instances of the game that we open on our local machine would run under the same network conditions. Don't forget to disable it once you're done debugging, else your network connection will feel slow! @@ -65,7 +65,7 @@ In this case we would want to have an ability to set artificial conditions on a > ParallelSync is **not** supported by Unity. More information on its usage is available [here](https://github.com/VeriorPies/ParrelSync). Troubleshooting information can be found [here](https://github.com/VeriorPies/ParrelSync/wiki/Troubleshooting-&-FAQs) -Simulator Tools effects only apply to editor instances and to [debug builds](#debug-builds), as such it matches well with [clone-based workflow via ParrelSync](testing_locally.md#parrelsync). +Simulator Tools effects only apply to editor instances and to [debug builds](#debug-builds), as such it matches well with [clone-based workflow via ParrelSync](#clone-based-workflow-parrelsync). Other tools should be used when testing release builds locally. From a1d5bbfd1a3b57439441bd52ba10635c02e9f276 Mon Sep 17 00:00:00 2001 From: "amy.reeve" Date: Fri, 24 Jul 2026 13:27:10 +0100 Subject: [PATCH 2/2] Typo in API docs --- .../Runtime/Messaging/RpcTargets/RpcTarget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/RpcTarget.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/RpcTarget.cs index 02fbe958e9..dd10eddc68 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/RpcTarget.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/RpcTarget.cs @@ -51,7 +51,7 @@ public enum SendTo ///
NotMe, /// - /// Send this RPC to everone, filtered to the current observer list. + /// Send this RPC to everyone, filtered to the current observer list. /// Will execute locally. /// Everyone, @@ -220,7 +220,7 @@ public void Dispose() public BaseRpcTarget NotMe; /// - /// Send this RPC to everone, filtered to the current observer list. + /// Send this RPC to everyone, filtered to the current observer list. /// Will execute locally. /// public BaseRpcTarget Everyone;