Skip to content

docs: Adding docs to the 1.13 version of the package #3520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
85 changes: 85 additions & 0 deletions com.unity.netcode.gameobjects/Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
* [Netcode for GameObjects package](index.md)
* [Install](install.md)
* [Get started with NGO](tutorials/get-started-with-ngo.md)
* [Configuration](configuration.md)
* [Network topologies](network-topologies.md)
* [Network topologies](terms-concepts/network-topologies.md)
* [Client-server](terms-concepts/client-server.md)
* [Listen server host architecture](learn/listenserverhostarchitecture.md)
* [Configuring connections](configure-connections.md)
* [Connection approval](basics/connection-approval.md)
* [Max players](basics/maxnumberplayers.md)
* [Transports](advanced-topics/transports.md)
* [Relay](relay/relay.md)
* [Network components](network-components.md)
* [NetworkObject](basics/networkobject.md)
* [NetworkObject parenting](advanced-topics/networkobject-parenting.md)
* [NetworkBehaviour](networkbehaviour-landing.md)
* [NetworkBehaviour](basics/networkbehaviour.md)
* [Synchronize](basics/networkbehaviour-synchronize.md)
* [Physics](advanced-topics/physics.md)
* [NetworkManager](components/networkmanager.md)
* [NetworkTransform](components/networktransform.md)
* [NetworkAnimator](components/networkanimator.md)
* [Ownership](basics/ownership.md)
* [Spawning and despawning](spawn-despawn.md)
* [Object spawning](basics/object-spawning.md)
* [Object pooling](advanced-topics/object-pooling.md)
* [Object visibility](basics/object-visibility.md)
* [Spawning synchronization](basics/spawning-synchronization.md)
* [Latency and performance](latency-performance.md)
* [Lag and packet loss](learn/lagandpacketloss.md)
* [Ticks and update rates](learn/ticks-and-update-rates.md)
* [Client-side interpolation](learn/clientside-interpolation.md)
* [Client anticipation](advanced-topics/client-anticipation.md)
* [Dealing with latency](learn/dealing-with-latency.md)
* [Network synchronization](network-synchronization.md)
* [Ways to synchronize](advanced-topics/ways-to-synchronize.md)
* [NetworkVariables](networkvariables-landing.md)
* [NetworkVariable](basics/networkvariable.md)
* [Custom NetworkVariables](basics/custom-networkvariables.md)
* [Remote procedure calls (RPCs)](rpc-landing.md)
* [Messaging system](advanced-topics/messaging-system.md)
* [RPC](advanced-topics/message-system/rpc.md)
* [Reliability](advanced-topics/message-system/reliability.md)
* [RPC params](advanced-topics/message-system/rpc-params.md)
* [RPC vs NetworkVariables](learn/rpcvnetvar.md)
* [RPC and NetworkVariable examples](learn/rpcnetvarexamples.md)
* [RPC compatibility](advanced-topics/message-system/rpc-compatibility.md)
* [Custom messages](advanced-topics/message-system/custom-messages.md)
* [Connection events](advanced-topics/connection-events.md)
* [Network update loop](network-update-loop.md)
* [About network update loop](advanced-topics/network-update-loop-system/index.md)
* [Network update loop reference](advanced-topics/network-update-loop-system/network-update-loop-reference.md)
* [Network time and ticks](advanced-topics/networktime-ticks.md)
* [Serialization](serialization.md)
* [C# primitives](advanced-topics/serialization/cprimitives.md)
* [Unity primitives](advanced-topics/serialization/unity-primitives.md)
* [Enum types](advanced-topics/serialization/enum-types.md)
* [Arrays](advanced-topics/serialization/serialization-arrays.md)
* [INetworkSerializable](advanced-topics/serialization/inetworkserializable.md)
* [Custom serialization](advanced-topics/custom-serialization.md)
* [NetworkObject serialization](advanced-topics/serialization/networkobject-serialization.md)
* [FastBufferWriter and FastBufferReader](advanced-topics/fastbufferwriter-fastbufferreader.md)
* [Scene management](scene-management.md)
* [Scene management overview](basics/scenemanagement/scene-management-overview.md)
* [Integrated management](integrated-management.md)
* [Using NetworkSceneManager](basics/scenemanagement/using-networkscenemanager.md)
* [Scene events](basics/scenemanagement/scene-events.md)
* [Client synchronization mode](basics/scenemanagement/client-synchronization-mode.md)
* [Timing considerations](basics/scenemanagement/timing-considerations.md)
* [In-scene placed NetworkObjects](basics/scenemanagement/inscene-placed-networkobjects.md)
* [Custom management](basics/scenemanagement/custom-management.md)
* [Session management](session-management-landing.md)
* [Session management](advanced-topics/session-management.md)
* [Reconnecting mid-game](advanced-topics/reconnecting-mid-game.md)
* [Testing and debugging](testing-debugging.md)
* [Testing locally](tutorials/testing/testing_locally.md)
* [Testing with artificial conditions](tutorials/testing/testing_with_artificial_conditions.md)
* [Testing client connection management](tutorials/testing/testing_client_connection_management.md)
* [Logging](basics/logging.md)
* [Techniques and tricks for debugging multiplayer games](tutorials/testing/techniques_and_tricks_for_debugging_multiplayer_games.md)
* [Command-line helper](tutorials/command-line-helper.md)
* [Troubleshooting](troubleshooting/troubleshooting.md)
* [Error messages](troubleshooting/error-messages.md)
* [FAQ](learn/faq.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# BufferSerializer

`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:

- 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
- `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`

These aren't without downsides, however:

- `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.
- `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.
- `BufferSerializer<TReaderWriter>` don't support any form of packed reads and writes.

However, when those downsides are unreasonable, `BufferSerializer<TReaderWriter>` offers two ways to perform more optimal serialization for either performance or bandwidth usage:

- For performance, you can use `PreCheck(int amount)` followed by `SerializeValuePreChecked()` to perform bounds checking for multiple fields at once.
- 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`.
Loading