Skip to content

Commit 306be64

Browse files
authored
NGO 2.1.1 (#1367)
1 parent 00007de commit 306be64

File tree

114 files changed

+15182
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+15182
-5
lines changed

docs/components/networkmanager.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: NetworkManager
55

66
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 PlayerObject and assigned to the newly connected and authorized client. For more information about player prefabs, refer to [PlayerObjects and player prefabs](../basics/playerobjects.md).
@@ -22,12 +22,19 @@ The `NetworkManager` is a required Netcode for GameObjects component that has al
2222
- **Enable Scene Management**: When checked, Netcode for GameObjects will handle scene management and client synchronization for you. When not checked, you will have to create your 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+
## Starting and stopping `NetworkManager`
26+
27+
There are two static event notifications available when [starting](#starting-a-server-host-or-client) or [stopping](#disconnecting-and-shutting-down) `NetworkManager`. If you need to know when a `NetworkManager` has been instantiated or when it's in the process of being destroyed, there are two event notifications you can subscribe to:
28+
29+
- The `NetworkManager.OnInstantiated` notification is triggered when a new `NetworkManager` instance has been instantiated.
30+
- The `NetworkManager.OnDestroying` notification is triggered when an existing `NetworkManager` instance is being destroyed.
31+
2532
### `NetworkManager` sub-systems
2633

27-
`NetworkManager` is also where you can find references to other Netcode related management systems:<br/>
34+
`NetworkManager` is also where you can find references to other Netcode-related management systems:
2835

2936
:::caution
30-
All `NetworkManager` sub-systems are instantiated once the `NetworkManager` is started (that is, `NetworkManager.IsListening == true`). A good general "rule of thumb" is to not attempt to access the below sub-systems before starting the `NetworkManager`, otherwise they won't yet be initialized.
37+
All `NetworkManager` sub-systems are instantiated once the `NetworkManager` is started (either when `NetworkManager.IsListening == true` or after you've received a `NetworkManager.OnInstantiated` notification). Don't attempt to access the following sub-systems before starting the `NetworkManager`, otherwise they won't yet be initialized.
3138
:::
3239

3340
- [NetworkManager.PrefabHandler](../advanced-topics/object-pooling.md): This provides access to the NetworkPrefabHandler that is used for NetworkObject pools and to have more control overriding network prefabs.
@@ -59,7 +66,7 @@ Don't start a `NetworkManager` within any `NetworkBehaviour` component's method;
5966
- [Connection Approval](../basics/connection-approval)
6067
:::
6168

62-
## Connecting
69+
### Connecting
6370

6471
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.
6572

@@ -247,3 +254,7 @@ public class ConnectionNotificationManager : MonoBehaviour
247254
}
248255
}
249256
```
257+
258+
## Additional resources
259+
260+
- [`NetworkManager` API documentation](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html)

docusaurus.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,13 @@ module.exports = {
237237
lastVersion: "current",
238238
versions: {
239239
current: {
240-
label: "2.0.0",
240+
label: "2.1.1",
241241
path: "current",
242242
},
243+
"2.0.0": {
244+
label: "2.0.0",
245+
path: "2.0.0",
246+
},
243247
"1.11.0": {
244248
label: "1.11.0",
245249
path: "1.11.0",

versioned_docs/version-2.0.0/about.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
id: about
3+
title: About Netcode for GameObjects
4+
description: Overview of Unity's Netcode for GameObjects for your multiplayer networking needs.
5+
---
6+
7+
Netcode for GameObjects is a high-level networking library built for Unity for you to abstract networking logic. You can send GameObjects and world data across a networking session to many players at once. With Netcode for GameObjects, you can focus on building your game instead of low-level protocols and networking frameworks.
8+
9+
To learn more about Netcode for GameObjects functionality and capabilities, explore the content below:
10+
11+
<!--
12+
<div className="table-columns-plain" >
13+
| Get Started | Configuration | Samples and Education|
14+
15+
</div>
16+
17+
<div className="table-columns-plain" >
18+
| Networking Components | Spawning and Ownership | Network Synchronization |
19+
20+
</div>
21+
22+
<div className="table-columns-plain" >
23+
| Serialization | Scenes | Sessions |
24+
25+
</div>
26+
27+
<div className="table-columns-plain" >
28+
| Test and Debug | Reference | Related Unity Gaming Services |
29+
30+
</div>
31+
-->
32+
33+
<div className="table-columns-plain" >
34+
35+
| Getting Started | Get Started Project | Education and Samples |
36+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
37+
| [Install Unity Netcode](installation/installation.md)<br/>[Migration from UNet to Netcode](installation/migratingfromUNet.md)<br/>[Upgrade to Unity Netcode Package](installation/migratingfrommlapi.md) | [Get started with Netcode](../docs/tutorials/get-started-with-ngo.md) | [Boss Room](learn/bossroom/getting-started-boss-room.md)<br/>[Bite Size Samples](learn/bitesize/bitesize-introduction.md)<br/>[Dilmer's Tutorials](community-contributions/dilmer-videos.md) |
38+
39+
</div>
40+
41+
<div className="table-columns-plain" >
42+
43+
| Core Concepts | Debugging | Terminology and FAQs |
44+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45+
| [Networking](basics/connection-approval.md)<br/>[Components](components/networkmanager.md)<br/>[Objects](basics/object-spawning.md)<br/>[Messaging System](advanced-topics/messaging-system.md)<br/>[Serialization](advanced-topics/serialization/serialization-intro.md)<br/>[Scenes](basics/scenemanagement/scene-management-overview.md) | [Logging](basics/logging.md)<br/>[Troubleshooting](troubleshooting/troubleshooting.md)<br/>[Error Messages](troubleshooting/error-messages.md) | [High Level Terminology](terms-concepts/mutliplayer-terms.md)<br/>[Multiplayer Game Architecture](terms-concepts/network-topologies.md)<br/>[FAQs](learn/faq.md) |
46+
47+
</div>
48+
49+
For more information, check out [Release Notes](release-notes/ngo-changelog.md) and [APIs](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/index.html).
50+
51+
## Before you begin
52+
53+
Netcode for GameObjects supports the following versions:
54+
55+
- Unity 6.0+ and later
56+
- Mono and IL2CPP [Scripting Backends](https://docs.unity3d.com/Manual/scripting-backends.html)
57+
58+
Netcode for GameObjects supports the following platforms:
59+
60+
- Windows, macOS, and Linux
61+
- iOS and Android
62+
- XR platforms running on Windows, Android, and iOS operating systems
63+
- Most [**closed platforms**](https://unity.com/platform-installation), such as consoles. Contact us for more information about specific closed platforms.
64+
- When working with consoles (such as PlayStation, Xbox, or Nintendo Switch), there may be Netcode-specific policies you should be aware of while testing and before launching your game live. Refer to the console's internal documentation for more information. This content is typically protected by NDA.
65+
- WebGL (requires Netcode for GameObjects 1.2.0+ and Unity Transport 2.0.0+)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
id: bufferserializer
3+
title: BufferSerializer
4+
sidebar_label: BufferSerializer
5+
---
6+
7+
`BufferSerializer<TReaderWriter>` is the bi-directional serializer primarily used for serializing within [`INetworkSerializable`](inetworkserializable.md) types. It wraps [`FastBufferWriter` and `FastBufferReader`](fastbufferwriter-fastbufferreader.md) to provide high performance serialization, but has a couple of differences to make it more user-friendly:
8+
9+
- Rather than writing separate methods for serializing and deserializing, `BufferSerializer<TReaderWriter>` allows writing a single method that can handle both operations, which reduces the possibility of a mismatch between the two
10+
- `BufferSerializer<TReaderWriter>` does bound checking on every read and write by default, making it easier to avoid mistakes around manual bounds checking required by `FastBufferWriter` and `FastBufferReader`
11+
12+
These aren't without downsides, however:
13+
14+
- `BufferSerializer<TReaderWriter>` has to operate on an existing mutable value due to its bi-directional nature, which means values like `List<T>.Count` have to be stored to a local variable before writing.
15+
- `BufferSerializer<TReaderWriter>` is slightly slower than `FastBufferReader` and `FastBufferWriter` due to both the extra pass-through method calls and the mandatory bounds checking on each write.
16+
- `BufferSerializer<TReaderWriter>` don't support any form of packed reads and writes.
17+
18+
However, when those downsides are unreasonable, `BufferSerializer<TReaderWriter>` offers two ways to perform more optimal serialization for either performance or bandwidth usage:
19+
20+
- For performance, you can use `PreCheck(int amount)` followed by `SerializeValuePreChecked()` to perform bounds checking for multiple fields at once.
21+
- For both performance and bandwidth usage, you can obtain the wrapped underlying reader/writer via `serializer.GetFastBufferReader()` when `serializer.IsReader` is `true`, and `serializer.GetFastBufferWriter()` when `serializer.IsWriter` is `true`. These provide micro-performance improvements by removing a level of indirection, and also give you a type you can use with `BytePacker` and `ByteUnpacker`.

0 commit comments

Comments
 (0)