Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.09k
stars
430
forks
source link
Wrong client ID passed to NetworkManager.OnClientDisconnectCallback #2799
When the host/client disconnects from the game server, the ID passed to NetworkManager.OnClientDisconnectedCallback on that Host/client is incorrect. When that same host/client connects using NetworkManager.OnClientConnectedCallback the id is correct and doesn't match the id when NetworkManager.OnClientDisconnectedCallback is called. If the client is not host everything works and ids are correct. Just the host/client has this issue.
Screenshot below
Reproduce Steps
In code, provide a callback function for NetworkManager.Singleton.OnClientDisconnectedCallback on the client.
In that callback function, print to the console the values for the function parameter and NetworkManager.Singleton.LocalClientId
Start a server using NetworkManager.StartHost()
Note the id passed in NetworkManager.Singleton.OnClientConnectedCallback
Start a client using StartClient()
After both are connected, disconnect the host.
Observe the console log on the Host/client and note that the two values are different.
Actual Outcome
When the host disconnects the client id passed is incorrect. It doesn't match the client id passed when the host/client connects using
OnClientConnectedCallback.
Expected Outcome
The client id passed in OnClientConnectedCallback should match the value passed in OnClientDisconnectedCallback.
Description
When the host/client disconnects from the game server, the ID passed to NetworkManager.OnClientDisconnectedCallback on that Host/client is incorrect. When that same host/client connects using NetworkManager.OnClientConnectedCallback the id is correct and doesn't match the id when NetworkManager.OnClientDisconnectedCallback is called. If the client is not host everything works and ids are correct. Just the host/client has this issue. Screenshot below
Reproduce Steps
Actual Outcome
When the host disconnects the client id passed is incorrect. It doesn't match the client id passed when the host/client connects using OnClientConnectedCallback.
Expected Outcome
The client id passed in OnClientConnectedCallback should match the value passed in OnClientDisconnectedCallback.
Screenshots
Environment