diff --git a/docs/basics/networkobject.md b/docs/basics/networkobject.md index d31af898c..ac75c91f9 100644 --- a/docs/basics/networkobject.md +++ b/docs/basics/networkobject.md @@ -20,11 +20,15 @@ When spawning a NetworkObject, the `NetworkObject.GlobalObjectIdHash` value init You can use [NetworkBehaviours](networkbehaviour.md) to add your own custom Netcode logic to the associated NetworkObject. -:::warning +### Component order -The order of networked objects matters. Make sure to load any NetworkBehaviour components before the Network Object component on the GameObject. +The order of components on a networked GameObject matters. When adding netcode components to a GameObject, ensure that the NetworkObject component is ordered before any NetworkBehaviour components. -::: +The order in which NetworkBehaviour components are presented in the **Inspector** view is the order in which each associated `NetworkBehaviour.OnNetworkSpawn` method is invoked. Any properties that are set during `NetworkBehaviour.OnNetworkSpawn` are set in the order that each NetworkBehaviour's `OnNetworkSpawned` method is invoked. + +#### Avoiding execution order issues + +You can avoid execution order issues in any NetworkBehaviour component scripts that have dependencies on other NetworkBehaviour components associated with the same NetworkObject by placing those scripts in an overridden `NetworkBehaviour.OnNetworkPostSpawn` method. The `NetworkBehaviour.OnNetworkPostSpawn` method is invoked on each NetworkBehaviour component after all NetworkBehaviour components associated with the same NetworkObject component have had their `NetworkBehaviour.OnNetworkSpawn` methods invoked (but they will still be invoked in the same execution order defined by their relative position to the NetworkObject component when viewed within the Unity Editor **Inspector** view). ## Ownership diff --git a/docs/basics/scenemanagement/client-synchronization-mode.md b/docs/basics/scenemanagement/client-synchronization-mode.md index 9a315ea78..2cabc9ed5 100644 --- a/docs/basics/scenemanagement/client-synchronization-mode.md +++ b/docs/basics/scenemanagement/client-synchronization-mode.md @@ -9,6 +9,10 @@ Client synchronization occurs when immediately after a client connects to a host The client synchronization mode should be set when the server or host is first provided via the `NetworkSceneManager.SetClientSynchronizationMode` method that takes a [`LoadSceneMode`](https://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.html) value as a parameter. Each client synchronization mode behaves in a similar way to loading a scene based on the chosen `LoadSceneMode`. +::note Distributed authority contexts +When using a [distributed authority network topology](../../terms-concepts/distributed-authority.md), any client can set the client synchronization mode when they're promoted to session owner. Late-joining clients are synchronized using whatever setting the current session owner has. +:: + ## Single Client Synchronization Mode _(Existing Client-Side Scenes Unloaded During Synchronization)_ diff --git a/docs/components/networkmanager.md b/docs/components/networkmanager.md index 81e7b816c..e6aec4848 100644 --- a/docs/components/networkmanager.md +++ b/docs/components/networkmanager.md @@ -47,7 +47,7 @@ NetworkManager.Singleton.StartClient(); // Starts the NetworkManager as jus ``` :::warning -Don't start a NetworkManager within a NetworkBehaviour's Awake method as this can lead to undesirable results depending upon your project's settings! +Don't start a `NetworkManager` within any `NetworkBehaviour` component's method; doing so can produce timing-related issues that cause the `NetworkManager` to only start once or not at all. `NetworkManager`s begin and end a network session, while `NetworkBehaviour` components are used during a network session. By the time you're using `NetworkBehaviour`s, a `NetworkManager` should already be running. ::: :::note diff --git a/docs/release-notes/ngo-changelog.md b/docs/release-notes/ngo-changelog.md index 94a52d157..f61795825 100644 --- a/docs/release-notes/ngo-changelog.md +++ b/docs/release-notes/ngo-changelog.md @@ -8,7 +8,8 @@ The following content tracks features, updates, bug fixes, and refactoring for t | Release | Date | Changelog | |---|---|---| -| 2.0.0-exp | 2024-04-02 | [2.0.0-exp](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.0/changelog/CHANGELOG.html) | +| 2.0.0-pre | 2024-06-17 | [2.0.0-pre](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.0/changelog/CHANGELOG.html) | +| 2.0.0-exp | 2024-04-02 | [2.0.0-exp](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.0/changelog/CHANGELOG.html#200-exp2---2024-04-02) | | 1.10.0 | 2024-07-22 | [1.10.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/release/1.10.0/com.unity.netcode.gameobjects/CHANGELOG.md) | | 1.9.1 | 2024-04-18 | [1.9.1](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.9.1) | | 1.8.0 | 2023-12-12 | [1.8.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.8.0) | diff --git a/docusaurus.config.js b/docusaurus.config.js index a73a62cbc..f31fd9ef7 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -237,7 +237,7 @@ module.exports = { lastVersion: "current", versions: { current: { - label: "2.0.0-exp", + label: "2.0.0-pre", path: "current", }, "1.10.0": { diff --git a/transport/workflow-client-server-secure.md b/transport/workflow-client-server-secure.md index 4d2c0590b..96cc877bd 100644 --- a/transport/workflow-client-server-secure.md +++ b/transport/workflow-client-server-secure.md @@ -134,7 +134,7 @@ void Start () When creating the `NetworkDriver`, pass in this `NetworkSettings` object: ```csharp -m_Driver = NetworkDriver.Create(settings); +m_Driver = NetworkDriver.Create(settings); ``` That’s all you need to do to enable secure communication server-side. @@ -149,7 +149,7 @@ The secure client is similar to the secure server. The only difference is in how void Start () { var settings = new NetworkSettings(); - settings.WithSecureServerParameters( + settings.WithSecureClientParameters( serverName: SecureParameters.ServerCommonName, caCertificate: SecureParameters.MyGameClientCA); m_Driver = NetworkDriver.Create(settings);