Skip to content

Commit 9c91c3b

Browse files
committed
docs: note the received-bytes overcount in get_stats, say register_prefab saves the list, and add the PR number to the changelog (MTT-16534)
- get_stats' docs and receive hook note that per-type received bytes can be up to 6 bytes a message high, because NetworkMessageManager reports the unpacked header size. Batch totals are exact. - register_prefab's description and docs say it saves the list and creates the default list if needed. - The CHANGELOG entry gets (#4210).
1 parent 1aa510b commit 9c91c3b

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎com.unity.netcode.gameobjects/CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1010

1111
### Added
1212

13-
- Added Unity CLI commands (`netcode.gameobjects` groups) to set up NetworkManagers and network prefabs, start and stop sessions, inspect clients and spawned objects, spawn, despawn and change ownership, simulate network conditions and sample network traffic. They are available when the project has `com.unity.pipeline` 0.9.0-exp.1 or later.
13+
- Added Unity CLI commands (`netcode.gameobjects` groups) to set up NetworkManagers and network prefabs, start and stop sessions, inspect clients and spawned objects, spawn, despawn and change ownership, simulate network conditions and sample network traffic. They are available when the project has `com.unity.pipeline` 0.9.0-exp.1 or later. (#4210)
1414
- Added alignment of the Netcode for Entities tick rates with `NetworkConfig.TickRate` when a session carrying `GhostObject` prefabs is started, so `GhostObject` updates land on the same interval as the rest of Netcode for GameObjects. (#4144)
1515
- Added `NetworkConfig.AutoConfigureSnapshotSize`, enabled by default, which sets the Netcode for Entities snapshot packet size to 4096 bytes when a session carrying `GhostObject` prefabs is started. Netcode for Entities defaults to a single MTU, which updates `GhostObject`s well below the tick rate at the instance counts Netcode for GameObjects projects typically run. Disable it to manage the value yourself. (#4144)
1616

‎com.unity.netcode.gameobjects/Documentation~/unity-cli-commands.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To test with several players, use [Multiplayer Play Mode](https://docs.unity3d.c
3333
| `change_owner` | Give a NetworkObject to another client, following the topology's ownership rules. |
3434
| `create_network_manager` | Add a NetworkManager with a UnityTransport to the active scene. |
3535
| `list_prefabs` | Network prefabs lists with their prefabs, and the lists and player prefab each NetworkManager uses. |
36-
| `register_prefab` | Add a network prefab to a network prefabs list. |
36+
| `register_prefab` | Add a network prefab to a network prefabs list and save the list. |
3737
| `make_prefab` | Add a NetworkObject to a prefab's root and report its prefab id hash. |
3838
| `audit` | Find setup problems that otherwise show when a session starts: in NetworkManagers (transport, topology, prefab lists, player prefab, hybrid prefab requirements) and in network prefabs (NetworkBehaviours without a NetworkObject, nested NetworkObjects, duplicate prefab ids, unregistered prefabs). `--scope config` or `--scope prefabs` runs one half. |
3939

@@ -43,6 +43,8 @@ To test with several players, use [Multiplayer Play Mode](https://docs.unity3d.c
4343
| :--- | :--- |
4444
| `get_stats` | Sample network traffic over a number of frames: bytes and messages sent and received, per message type. |
4545

46+
The total bytes sent and received are exact. Per message type, the bytes received can be overstated by up to 6 bytes per message, because Netcode for GameObjects reports received messages with their header's unpacked size.
47+
4648
### netcode.gameobjects.session
4749

4850
| **Command** | **Description** |

‎com.unity.netcode.gameobjects/Editor/CLI/NetcodeGameObjectsCliCommands.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static object ListPrefabs(
7676
[CliArg("list", "Only lists whose path contains this text.")] string list = null)
7777
=> NgoCliOutput.ToWire(NgoCliQueries.ListPrefabs(list));
7878

79-
[CliGroupCommand(k_Group, "Add a network prefab to a network prefabs list (the given one, else the scene's NetworkManager's, else the default). Reports when it's already registered. Not allowed in play mode.", Tags = new[] { Tag })]
79+
[CliGroupCommand(k_Group, "Add a network prefab to a network prefabs list (the given one, else the scene's NetworkManager's, else the default, which is created if needed). Reports when it's already registered. Saves the list. Not allowed in play mode.", Tags = new[] { Tag })]
8080
private static object RegisterPrefab(
8181
[CliArg("prefab", "Prefab path, GUID or name.", Required = true)] string prefab,
8282
[CliArg("list", "NetworkPrefabsList asset path.")] string list = null,

‎com.unity.netcode.gameobjects/Editor/CliQueries/NgoCliQueries.Stats.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ public void OnAfterSendMessage<T>(ulong clientId, ref T message, NetworkDelivery
143143
stat.BytesSent += messageSizeBytes;
144144
}
145145

146+
// NetworkMessageManager reports a received message with the unpacked header size, so the per-type received
147+
// bytes can be up to 6 bytes a message more than went over the network. The batch totals are exact.
146148
public void OnBeforeReceiveMessage(ulong senderId, Type messageType, int messageSizeBytes)
147149
{
148150
var stat = For(messageType);

0 commit comments

Comments
 (0)