Search Issue Tracker

Fixed

Fixed in 1.0.0-pre.7

Votes

0

Found in [Package]

1.0.0-pre.3

Issue ID

NCCBUG-130

Regression

Yes

[NetCode] OnClientDisconnectCallback is not working with UNet Transport

Package: Multiplayer Netcode for GameObjects

-

Steps to reproduce:
1. Open the attached project with version 2022.1.0b11
2. Open the scene Scenes/StartMenu
3. Enter Play mode
4. Press Join LAN Game

Expected result: The connection should fail because the connection data is wrong and appropriately trigger the OnDisconnectOrTimeout function assigned to the OnClientDisconnectCallback in MenuControl.cs
Actual result: KeyNotFoundException: The given key '2' was not present in the dictionary.

This is working correctly when using the Unity Trasnport + the NetCode Adapter so this might be a potential bug.
It was verified that the same code in NetworkManager.HandleRawTransportPoll does not throw an exception when using the other transport.

Full stack:
KeyNotFoundException: The given key '2' was not present in the dictionary.
System.Collections.Generic.Dictionary`2\[TKey,TValue].get_Item (TKey key) (at <2857828c91ae4d2f8f69f65efd8d87ec>:0)
Unity.Netcode.NetworkManager.TransportIdToClientId (System.UInt64 transportId) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1244)
Unity.Netcode.NetworkManager.HandleRawTransportPoll (Unity.Netcode.NetworkEvent networkEvent, System.UInt64 clientId, System.ArraySegment`1\[T] payload, System.Single receiveTime) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1313)
Unity.Netcode.NetworkManager.OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1150)
Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1125)
Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:149)
Unity.Netcode.NetworkUpdateLoop+NetworkEarlyUpdate+<>c.<CreateLoopSystem>b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:172)

  1. Resolution Note (fix version 1.0.0-pre.7):

    Fixed in PR-1821

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.