# Netcode for Gameobjects 2.4.0 released

**URL:** https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980
**Category:** Netcode for GameObjects
**Tags:** Netcode-for-GameObjects, Releases
**Created:** [June 5, 2025, 5:12pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980 "2025-06-05T17:12:30Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![michal\_chrobot](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/michal_chrobot/32/253740_2.png) [@michal\_chrobot](https://discussions.unity.com/u/michal_chrobot)
#### Post date: [June 5, 2025, 5:12pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/1 "2025-06-05T17:12:30Z")

</div>

📦 [Netcode for GameObjects v2.4.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F2.4.0) **is now publicly available!** 📦

Crack your knuckles and get ready for another Netcode for GameObjects update! The v2.4.0 update includes a wide range of fixes along with the added `SingelPlayerTransport` that allows you to run a single player hosted session without any need for a lower-layer transport. `NetworkObject` , `NetworkBehaviour` , and `NetworkVariable` serialization sizes were all increased from `ushort.maxvalue` to `int.maxvalue` . The distributed authority network topology’s connection sequence has been improved to resolve some known initial client synchronization related issues.

_Happy Netcoding!_

> **Fixed**
>
> - Fixed issue where the `NetworkObject.DontDestroyWithOwner` was not being honored.
> - Fixed issue where non-authority `NetworkTransform` instances would not allow non-synchronized axis values to be updated locally.
> - Fixed issue where invoking `NetworkObject.NetworkShow` and `NetworkObject.ChangeOwnership` consecutively within the same call stack location could result in an unnecessary change in ownership error message generated on the target client side.
> - Fixed issue where `NetworkVariable`s on a `NetworkBehaviour` could fail to synchronize changes if one has `NetworkVariableUpdateTraits` set and is dirty but is not ready to send.
> - Fixed issue with the Distributed Authority connection sequence with scene management enabled where the `ClientConnected` event was fired before the client was synchronized.
> - Fixed inconsistencies in the `OnSceneEvent` callback.
> - Fixed issues with the `NetworkBehaviour` and `NetworkVariable` length safety checks.
> - Fixed memory leaks when domain reload is disabled.
> - Fixed issue where disabling the physics or physics2D package modules could result in a compilation error.
> - Fixed an exception being thrown when unregistering a custom message handler from within the registered callback.

> **Added**
>
> - Added `SinglePlayerTransport` that provides the ability to start as a host for a single player network session.
> - When using UnityTransport \>=2.4 and Unity \>= 6000.1.0a1, SetConnectionData will accept a fully qualified hostname instead of an IP as a connect address on the client side.

---

<div class="post-metadata">

### Author: ![EdEddnEddy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ededdneddy/32/788327_2.png) [@EdEddnEddy](https://discussions.unity.com/u/EdEddnEddy)
#### Post date: [June 6, 2025, 10:52am UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/2 "2025-06-06T10:52:59Z")

</div>

Looks like this update broke connection flow in my project.

The client receives the following error in `SynchronizeNetworkObjects`:

```auto
KeyNotFoundException: The given key '-98622' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <314938d17f3848e8ac683e11b27f62ee>:0)
Unity.Netcode.NetworkSceneManager.SynchronizeNetworkObjects (System.UInt64 clientId, System.Boolean synchronizingService) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/SceneManagement/NetworkSceneManager.cs:2018)
Unity.Netcode.ConnectionApprovedMessage.Handle (Unity.Netcode.NetworkContext& context) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/Messages/ConnectionApprovedMessage.cs:259)
Unity.Netcode.NetworkMessageManager.ReceiveMessage[T] (Unity.Netcode.FastBufferReader reader, Unity.Netcode.NetworkContext& context, Unity.Netcode.NetworkMessageManager manager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:563)
Unity.Netcode.NetworkMessageManager.HandleMessage (Unity.Netcode.NetworkMessageHeader& header, Unity.Netcode.FastBufferReader reader, System.UInt64 senderId, System.Single timestamp, System.Int32 serializedHeaderSize) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:422)
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.NetworkMessageManager:HandleMessage(NetworkMessageHeader&, FastBufferReader, UInt64, Single, Int32) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:426)
Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue() (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:448)
Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:340)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:191)
Unity.Netcode.<>c:<CreateLoopSystem>b__0_0() (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:214)

```

The session owner gets this error message as the client connects:

```auto
You cannot start a host when connecting to a distributed authority CMB Service!
UnityEngine.Debug:LogError (object)
Unity.Netcode.NetworkClient:SetRole (bool,bool,Unity.Netcode.NetworkManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Connection/NetworkClient.cs:94)
Unity.Netcode.NetworkConnectionManager:AddClient (ulong) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Connection/NetworkConnectionManager.cs:1013)
Unity.Netcode.NetworkSceneManager:HandleSessionOwnerEvent (uint,ulong) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/SceneManagement/NetworkSceneManager.cs:2465)
Unity.Netcode.NetworkSceneManager:HandleSceneEvent (ulong,Unity.Netcode.FastBufferReader) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/SceneManagement/NetworkSceneManager.cs:2664)
Unity.Netcode.SceneEventMessage:Handle (Unity.Netcode.NetworkContext&) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/Messages/SceneEventMessage.cs:29)
Unity.Netcode.NetworkMessageManager:ReceiveMessage<Unity.Netcode.SceneEventMessage> (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkMessageManager) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:563)
Unity.Netcode.NetworkMessageManager:HandleMessage (Unity.Netcode.NetworkMessageHeader&,Unity.Netcode.FastBufferReader,ulong,single,int) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:422)
Unity.Netcode.NetworkMessageManager:ProcessIncomingMessageQueue () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Messaging/NetworkMessageManager.cs:448)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:340)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:191)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:214)

```

This happens in `NetworkSceneManager` as I have enabled automatic scene management. Once I get this set of errors, my logs are then followed by on the session owner and the client:

```auto
Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak

```

Additionally, after this set of exceptions, the client then receives more errors + warnings:

```auto
Detected DAHost mode. This is an unsupported configuration. Falling back to ClientServer. Please start Distributed Authority mode as client.
UnityEngine.Debug:LogWarning (object)
Unity.Services.DistributedAuthority.DistributedAuthorityTransport:OnCurrentTopology () (at ./Library/PackageCache/com.unity.services.multiplayer@e9296dd42336/Runtime/DistributedAuthority/SDK/DistributedAuthorityTransport.cs:25)
Unity.Netcode.NetworkTransport:CurrentTopology () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Transports/NetworkTransport.cs:165)
Unity.Netcode.NetworkManager:UpdateTopology () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:307)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:329)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:191)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:214)

[Session-Owner Sender=0] [Topology Mismatch] Transport detected an issue with the topology (ClientServer | DistributedAuthority) usage or setting! Disconnecting from session.
UnityEngine.Debug:LogError (object)
Unity.Netcode.NetworkLog:LogErrorServerLocal (string,ulong) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Logging/NetworkLog.cs:129)
Unity.Netcode.NetworkLog:LogServer (string,Unity.Netcode.NetworkLog/LogType) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Logging/NetworkLog.cs:94)
Unity.Netcode.NetworkLog:LogErrorServer (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Logging/NetworkLog.cs:58)
Unity.Netcode.NetworkManager:UpdateTopology () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:310)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkManager.cs:329)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:191)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@9684ced5879f/Runtime/Core/NetworkUpdateLoop.cs:214)

```

I’ve added a couple of log messages to `UpdateServerClientSceneHandle` to see when the scene handle mappings get populated and it looks the `ClientSceneHandleToServerSceneHandle` is populated too late (its populated right after this exception), which leads me to believe that scenes are now synchronized too late or incorrectly.

The way I reproduced this in my project (`Scene 1` in this case is my bootstrap scene, always loaded after the game starts):

- `Client A` starts a `Session A` in (`Scene 1`, `Scene 2` (additive, active)).
- `Client B` starts a `Session B` in (`Scene 1`, `Scene 3` (additive, active)).
- `Client B` leaves `Session B` and starts loading another set of scenes (`Scene 1`, `Scene 2` (additive, active)).
- Right after the scenes are finished loading, `Client B` starts joining `Session A`.
- `Client B` gets `KeyNotFoundException` log message.
- `Client A` (session owner) gets `CMB Services` log message.
- The network session is in broken state where `Client B` sees `Client A` (session owner) locked in place and `Client A` doesn’t see `Client B`.

Some details:

- Unity `6000.0.47f1`.
- Multiplayer Play mode `1.3.3`.
- Using sessions API.
- I did not update any other packages prior to trying out `v2.4.0`.
- Distributed Authority.
- Session owner uses `CreateSessionAsync`.
- Client uses `QuerySessionsAsync` and then passes the id to `CreateOrJoinSessionAsync`.

---

<div class="post-metadata">

### Author: ![NoelStephens\_Unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/noelstephens_unity/32/92797_2.png) [@NoelStephens\_Unity](https://discussions.unity.com/u/NoelStephens_Unity)
#### Post date: [June 6, 2025, 5:48pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/3 "2025-06-06T17:48:24Z")

</div>

> [@EdEddnEddy](#):
>
> `Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak`

This issue was discovered just shortly after v2.4.0 was made public and has a pending fix for it in [PR-3486](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/3486). The fix for this will be released in a patch soon. The memory leak itself is roughly the `size of a ulong` \* `number of connected clients`. So, it is a relatively small leak that happens once per non-session owner connecting to an existing session…but will be resolved very soon.

The other issue I am looking into today.

---

<div class="post-metadata">

### Author: ![NoelStephens\_Unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/noelstephens_unity/32/92797_2.png) [@NoelStephens\_Unity](https://discussions.unity.com/u/NoelStephens_Unity)
#### Post date: [June 9, 2025, 9:08pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/4 "2025-06-09T21:08:12Z")

</div>

> [@EdEddnEddy](#):
>
> The session owner gets this error message as the client connects:

I believe [PR-3491](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/3491) should resolve this issue.

If you have time, try using this branch and see if it resolves the issue on your side?

```auto
 "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#fix/reset-networkclient-completely-upon-shutdown",

```

This will be included in an up-and-coming patch.

---

<div class="post-metadata">

### Author: ![EdEddnEddy](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ededdneddy/32/788327_2.png) [@EdEddnEddy](https://discussions.unity.com/u/EdEddnEddy)
#### Post date: [June 10, 2025, 12:53pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/5 "2025-06-10T12:53:05Z")

</div>

> [@NoelStephens\_Unity](#):
>
> ` "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#fix/reset-networkclient-completely-upon-shutdown",`

Just tested this now, I can confirm that the bug I mentioned earlier, including the warnings related to leaks are no longer there!

---

<div class="post-metadata">

### Author: ![NoelStephens\_Unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/noelstephens_unity/32/92797_2.png) [@NoelStephens\_Unity](https://discussions.unity.com/u/NoelStephens_Unity)
#### Post date: [June 10, 2025, 3:07pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/6 "2025-06-10T15:07:31Z")

</div>

Thank you for providing the issue and for verifying the fix on your end.  
It is much appreciated!

These fixes will follow the pending v2.4.1 update (primarily internal house keeping adjustments) most likely as v2.4.2 (_exact version TBD_).

---

<div class="post-metadata">

### Author: ![michal\_chrobot](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/michal_chrobot/32/253740_2.png) [@michal\_chrobot](https://discussions.unity.com/u/michal_chrobot)
#### Post date: [June 17, 2025, 8:45am UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/7 "2025-06-17T08:45:45Z")

</div>

Hey, as a follow up, **NGOv2.4.2** is already released ([CHANGELOG](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.4/changelog/CHANGELOG.html#242---2025-06-13)) which contains all the fixes mentioned before in the thread.

We would also like to point out that **NGOv2.4.1** ([CHANGELOG](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@2.4/changelog/CHANGELOG.html#241---2025-06-11)) contained a bunch of structure updates so remember that **if you are utilizing TestHelpers** then follow the instruction from the CHANGELOG

> If your project is using the `Unity.Netcode.TestHelpers.Runtime` assembly then you need to switch `asmdef` references to `Unity.Netcode.Runtime.Tests` .

_Happy Netcoding!_

---

<div class="post-metadata">

### Author: ![michal\_chrobot](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/michal_chrobot/32/253740_2.png) [@michal\_chrobot](https://discussions.unity.com/u/michal_chrobot)
#### Post date: [June 27, 2025, 1:23pm UTC](https://discussions.unity.com/t/netcode-for-gameobjects-2-4-0-released/1651980/8 "2025-06-27T13:23:46Z")

</div>

Quick mention that [NGOv2.4.3](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/v2.4.3) was released as a response to issue reported **[HERE](https://discussions.unity.com/t/network-objects-dont-despawn-on-disconnect-even-with-dont-destroy-with-owner-unchecked/1658887/7)** 👈
