You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/basics/scenemanagement/using-networkscenemanager.md
+10-12
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ sidebar_label: Using NetworkSceneManager
7
7
## Netcode for GameObjects Integrated Scene Management
8
8
### The `NetworkSceneManager` Provides You With:
9
9
- An existing framework that supports both the bootstrap and scene transitioning scene management usage patterns.
10
-
- Automated client synchronization that occurs when a client is connected and approved.
10
+
- Automated client synchronization that occurs when a client is connected and approved.
11
11
- All scenes loaded via `NetworkSceneManager` will be synchronized with clients during client synchronization.
12
12
-_Later in this document, you will learn more about using scene validation to control what scenes are synchronized on the client, server, or both side(s)_.
13
13
- All spawned Netcode objects are synchronized with clients during client synchronization.
@@ -57,11 +57,11 @@ In order to load a scene, there are four requirements:
57
57
4. A Scene Event can't already be in progress.
58
58
59
59
#### Basic Scene Loading Example
60
-
Imagine that you have an in-scene placed NetworkObject, let's call it "ProjectSceneManager", that handles your project's scene management using the `NetworkSceneManager` and you wanted your server to load a scene when the ProjectSceneManager is spawned.
60
+
Imagine that you have an in-scene placed NetworkObject, let's call it "ProjectSceneManager", that handles your project's scene management using the `NetworkSceneManager` and you wanted your server to load a scene when the ProjectSceneManager is spawned.
61
61
In its simplest form, it can look something like:
62
62
```csharp
63
63
publicclassProjectSceneManager : NetworkBehaviour
64
-
{
64
+
{
65
65
/// INFO: You can remove the #if UNITY_EDITOR code segment and make SceneName public,
66
66
/// but this code assures if the scene name changes you won't have to remember to
67
67
/// manually update it.
@@ -131,14 +131,14 @@ You can be notified of scene events by registering in one of two ways:
131
131
1. Receive all scene event notification types: `NetworkSceneManager.OnSceneEvent`
132
132
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)<br/>
133
133
:::info
134
-
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.
134
+
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.
135
135
:::
136
136
137
137
**Receiving All Scene Event Notifications**
138
-
Typically, this is used on the server side to receive notifications for every scene event notification type for both the server and clients. You can receive all scene event type notifications by subscribing to the `NetworkSceneManager.OnSceneEvent` callback handler.
138
+
Typically, this is used on the server side to receive notifications for every scene event notification type for both the server and clients. You can receive all scene event type notifications by subscribing to the `NetworkSceneManager.OnSceneEvent` callback handler.
139
139
140
140
**Receiving A Specific Scene Event Notification**
141
-
Typically, this is used with clients or components that might only need to be notified of a specific scene event type. There are 9 scene event types and each one has a corresponding "single event type" callback handler in `NetworkSceneManager`.
141
+
Typically, this is used with clients or components that might only need to be notified of a specific scene event type. There are 9 scene event types and each one has a corresponding "single event type" callback handler in `NetworkSceneManager`.
142
142
143
143
**As an example:**
144
144
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.
@@ -173,7 +173,7 @@ Unloading the currently active scene, in Netcode, is commonly referred to as "sc
173
173
:::
174
174
175
175
#### Basic Scene Unloading Example
176
-
Below we are taking the previous scene loading example, the `ProjectSceneManager` class, and modifying it to handle unloading. This includes keeping a reference to the `SceneEvent.Scene` locally in our class because `NetworkSceneManager.Unload` requires the `Scene` to be unloaded.
176
+
Below we are taking the previous scene loading example, the `ProjectSceneManager` class, and modifying it to handle unloading. This includes keeping a reference to the `SceneEvent.Scene` locally in our class because `NetworkSceneManager.Unload` requires the `Scene` to be unloaded.
177
177
178
178
**Below is an example of how to:**
179
179
- Subscribe the server to `NetworkSceneManager.OnSceneEvent` notifications.
@@ -301,7 +301,7 @@ Really, if you take away the debug logging code the major differences are:
301
301
### Scene Validation
302
302
Sometimes you might need to prevent the server or client from loading a scene under certain conditions. Here are a few examples of when you might do this:
303
303
- One or more game states determine if a scene is loaded additively
304
-
- Typically, this is done on the server-side.
304
+
- Typically, this is done on the server-side.
305
305
- The scene is already pre-loaded on the client
306
306
- Typically, this is done on the client-side.
307
307
- Security purposes
@@ -345,7 +345,7 @@ The callback is the first thing invoked on the server-side when invoking the `Ne
345
345
346
346
:::caution
347
347
**Client-Side Scene Validation**<br/>
348
-
This is where you need to be cautious with scene validation, because any scene that you don't validate on the client side should not contain Netcode objects that are considered required dependencies for a connecting client to properly synchronize with the current netcode (game) session state.
348
+
This is where you need to be cautious with scene validation, because any scene that you don't validate on the client side should not contain Netcode objects that are considered required dependencies for a connecting client to properly synchronize with the current netcode (game) session state.
349
349
:::
350
350
351
351
### Dynamically Generated Scenes
@@ -368,7 +368,5 @@ See Also: [Client Synchronization Mode](client-synchronization-mode.md)
368
368
369
369
370
370
### What Next?
371
-
We have covered how to access the `NetworkSceneManager`, how to load and unload a scene, provided a basic overview on scene events and notifications, and even briefly discussed in-scene placed NetworkObjects. You now have the fundamental building-blocks one needs to learn more advanced integrated scene management topics.
371
+
We have covered how to access the `NetworkSceneManager`, how to load and unload a scene, provided a basic overview on scene events and notifications, and even briefly discussed in-scene placed NetworkObjects. You now have the fundamental building-blocks one needs to learn more advanced integrated scene management topics.
372
372
_We recommend proceeding to the next integrated scene management topic, "Client Synchronization Mode", in the link below._
373
-
374
-
<!-- Explore the [Netcode Scene Management Golden Path](link) for step-by-step examples of additive scene loading and management. -->
Copy file name to clipboardExpand all lines: docs/installation/migratingfromUNet.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -343,7 +343,7 @@ In Netcode for GameObjects, RPC function names must end with an `Rpc` suffix.
343
343
344
344
See [Messaging System](../advanced-topics/messaging-system.md) for more information.
345
345
346
-
## Replace `OnServerAddPlayer`
346
+
## Replace `OnServerAddPlayer`
347
347
348
348
Replace `OnServerAddPlayer` with `ConnectionApproval` everywhere in your project.
349
349
@@ -663,7 +663,7 @@ Netcode for GameObjects doesn't provide Network Discovery. The Contributions rep
663
663
664
664
After migrating to the Netcode for GameObjects package, you can review the following for what to do next:
665
665
666
-
*Consider using the [Hello World](../tutorials/helloworld.md) and [Golden Path series](../tutorials/goldenpath_series/gp_intro.md) to learn some basics of Netcode for GameObjects.
666
+
*Follow the [client-server quickstart](../tutorials/get-started-with-ngo.md) to learn some basics of Netcode for GameObjects.
667
667
* Explore the educational samples content for a deeper exploration into Netcode for GameObjects:
Copy file name to clipboardExpand all lines: docs/installation/migratingfrommlapi.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,7 @@ If this appears when you enter Play Mode or save a scene, close the Unity Editor
148
148
149
149
After migrating to the Netcode for GameObjects package, you can review the following for what to do next:
150
150
151
-
*Consider using the [Hello World](../tutorials/helloworld.md) and [Golden Path series](../tutorials/goldenpath_series/gp_intro.md) to learn some basics of Netcode for GameObjects.
151
+
*Follow the [client-server quickstart](../tutorials/get-started-with-ngo.md) to learn some basics of Netcode for GameObjects.
152
152
* Explore the educational samples content for a deeper exploration into Netcode for GameObjects:
<figcaption>To ensure that several different Network Variables are all synchronized at the same exact time we can use client RPC to join these value changes together.</figcaption>
103
-
</figure>
104
-
105
-
`NetworkVariable`s are great when you only care about the latest value.
106
-
107
-
:::
108
-
109
-
110
84
## Summary
111
85
112
86
`NetworkVariable`s are great for managing state, to make sure everyone has the latest value. Use them when you want to make sure newly connected players get an up to date world state.
0 commit comments