Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit 694ade4

Browse files
Multiple issue fixes (#1250)
Co-authored-by: Vic Cooper <[email protected]>
1 parent c34f756 commit 694ade4

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

docs/basics/networkobject.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ id: networkobject
33
title: NetworkObject
44
---
55

6+
A NetworkObject is a [GameObject](https://docs.unity3d.com/Manual/GameObjects.html) with a NetworkObject component and at least one [NetworkBehaviour](networkbehaviour.md) component, which enables the GameObject to respond to and interact with netcode.
7+
68
Netcode for GameObjects' high level components, [the RPC system](../advanced-topics/messaging-system.md), [object spawning](../object-spawning), and [NetworkVariable](networkvariable.md)s all rely on there being at least two Netcode components added to a GameObject:
79

810
1. `NetworkObject`

docs/components/networkmanager.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ id: networkmanager
33
title: NetworkManager
44
---
55

6-
The `NetworkManager` is a required **Netcode for GameObjects (Netcode)** component that has all of your project's netcode related settings. Think of it as the "central netcode hub" for your netcode enabled project.
6+
The `NetworkManager` is a required Netcode for GameObjects component that has all of your project's netcode-related settings. Think of it as the central netcode hub for your netcode-enabled project.
77

8-
### `NetworkManager` Inspector properties
8+
## `NetworkManager` Inspector properties
99

1010
- **LogLevel**: Sets the network logging level
1111
- **PlayerPrefab**: When a Prefab is assigned, the Prefab will be instantiated as the player object and assigned to the newly connected and authorized client.
@@ -22,7 +22,7 @@ The `NetworkManager` is a required **Netcode for GameObjects (Netcode)** compone
2222
- **Enable Scene Management**: When checked Netcode for GameObjects will handle scene management and client synchronization for you. When not checked, users will have to create their own scene management scripts and handle client synchronization.
2323
- **Load Scene Time Out**: When Enable Scene Management is checked, this specifies the period of time the `NetworkSceneManager` will wait while a scene is being loaded asynchronously before `NetworkSceneManager` considers the load/unload scene event to have failed/timed out.
2424

25-
### `NetworkManager` sub-systems
25+
## `NetworkManager` sub-systems
2626

2727
`NetworkManager` is also where you can find references to other Netcode related management systems:<br/>
2828

@@ -39,7 +39,7 @@ All `NetworkManager` sub-systems are instantiated once the `NetworkManager` is s
3939

4040
## Starting a server, host, or client
4141

42-
In order to perform any netcode related action that involves sending messages, you must first have a server started and listening for connections with at least one client (_a server can send RPCs to itself when running as a host_) that is connected. to accomplish this, you must first start your `NetworkManager` as a server, host, or client. There are three `NetworkManager` methods you can invoke to accomplish this:
42+
In order to perform any netcode-related action that involves sending messages, you must first have a server started and listening for connections with at least one client (_a server can send RPCs to itself when running as a host_) that is connected. To accomplish this, you must first start your `NetworkManager` as a server, host, or client. There are three `NetworkManager` methods you can invoke to accomplish this:
4343

4444
```csharp
4545
NetworkManager.Singleton.StartServer(); // Starts the NetworkManager as just a server (that is, no local client).
@@ -52,7 +52,8 @@ Don't start a NetworkManager within a NetworkBehaviour's Awake method as this ca
5252
:::
5353

5454
:::note
55-
When starting a Server or joining an already started session as client, the `NetworkManager` can spawn a "Player Object" belonging to the client.
55+
56+
When starting a server or joining an already started session as client, the `NetworkManager` can spawn a "Player Object" belonging to the client.
5657

5758
For more information about player prefabs see:
5859
- [NetworkObject Player Prefab Documentation](../basics/networkobject.md#player-objects)
@@ -61,7 +62,7 @@ Don't start a NetworkManager within a NetworkBehaviour's Awake method as this ca
6162

6263
## Connecting
6364

64-
When Starting a Client, the `NetworkManager` uses the IP and the Port provided in your `Transport` component for connecting. While you can set the IP address in the editor, many times you might want to be able to set the IP address and port during runtime.
65+
When starting a client, the `NetworkManager` uses the IP and the Port provided in your `Transport` component for connecting. While you can set the IP address in the editor, many times you might want to be able to set the IP address and port during runtime.
6566

6667
The below examples use [Unity Transport](../../../transport/current/about) to show a few ways you can gain access to the `UnityTransport` component via the `NetworkManager.Singleton` to configure your project's network settings programmatically:
6768

@@ -74,6 +75,7 @@ NetworkManager.Singleton.GetComponent<UnityTransport>().SetConnectionData(
7475
```
7576

7677
If you are using the same code block to configure both your server and your client and you want to configure your server to listen to all IP addresses assigned to it, then you can also pass a 'listen address' of "0.0.0.0" to the `SetConnectionData` method, like so:
78+
7779
```csharp
7880
NetworkManager.Singleton.GetComponent<UnityTransport>().SetConnectionData(
7981
"127.0.0.1", // The IP address is a string
@@ -125,7 +127,8 @@ The server-host attempts to wait for all client connections to close before it f
125127

126128
## Disconnecting clients (server only)
127129

128-
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:
130+
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:
131+
129132
- 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).
130133
- As a read only list of `NetworkClients` via the `NetworkManager.ConnectedClientsList`.
131134
- A full list of all connected client identifiers can be accessed via `NetworkManager.ConnectedClientsIds`.
@@ -151,13 +154,15 @@ Both the client and the server can subscribe to the `NetworkManager.OnClientDisc
151154
**When disconnect notifications are triggered:**
152155
- Clients are notified when they're disconnected by the server.
153156
- The server is notified when any client disconnects from the server, whether the server disconnects the client or the client disconnects itself.
154-
- Both the server and clients are notified when their network connection is unexpectedly disconnected (network interruption)
157+
- Both the server and clients are notified when their network connection is unexpectedly disconnected (network interruption).
155158

156159
**Client notification identifiers**
157160
- On the server-side, the client identifier parameter is the identifier of the client that disconnects.
158161
- On the client-side, the client identifier parameter is the identifier assigned to the client.
159162
- _The exception to this is when a client is disconnected before its connection is approved._
160163

164+
You can also use the `NetworkManager.OnServerStopped` and `NetworkManager.OnClientStopped` callbacks to get local notifications when the server or client stops respectively.
165+
161166
### Connection notification manager example
162167

163168
Below is one example of how you can provide client connect and disconnect notifications to any type of NetworkBehaviour or MonoBehaviour derived component.

docs/tutorials/get-started-with-ngo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ This section guides you through testing the RPCs you added in the earlier sectio
178178
1. Select **File** > **Build And Run**.
179179
2. Stop the player.
180180
3. Launch the client and server together in a terminal, as shown in [Testing the command line helper](command-line-helper.md).
181-
* Alternatively, you can use Multiplayer Play Mode package, which lets you run multiple instances of the Unity Editor to test multiplayer functionality. Refer to [Multiplayer Play Mode](https://docs-multiplayer.unity3d.com/tools/current/mppm) to learn more.
182181

183182
After the client and server spawn, a log displays in the **Console** of the client and server sending RPC messages to each other.
184183

@@ -220,6 +219,8 @@ The `NetworkObjectId` here is `2` because the host also has a NetworkObject with
220219

221220
:::
222221

222+
Alternatively, you can use the Multiplayer Play Mode package, which lets you run multiple instances of the Unity Editor to test multiplayer functionality. Refer to the [Multiplayer Play Mode documentation](https://docs-multiplayer.unity3d.com/mppm/current/about/) to learn more.
223+
223224
## Extend functionality with scripts
224225

225226
The section shows how to extend the functionality of the Hello World project with two scripts: [`HelloWorldPlayer.cs`](#the-helloworldplayercs-script) and [`HelloWorldManager.cs`](#the-helloworldmanagercs-script).

transport/workflow-client-server-udp.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ The client-server workflow in this guide shows the subtle differences between us
2828

2929
A server is an endpoint that listens for incoming connection requests and sends and receives messages. This section shows creating a simple server with UTP 2.0.
3030

31-
Start by creating a C# script in the Unity Editor. Name the script ServerBehaviour.cs.
32-
33-
**Filename**: [`ServerBehaviour.cs`](samples/serverbehaviour.cs.md)
31+
Start by creating a C# script in the Unity Editor. Name the script `ServerBehaviour.cs`.
3432

3533
```csharp
3634
using System.Collections;

0 commit comments

Comments
 (0)