Skip to content

Wrong client ID passed to NetworkManager.OnClientDisconnectCallback #2799

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

Closed
JoshJarc opened this issue Dec 29, 2023 · 1 comment
Closed
Labels
type:bug Bug Report

Comments

@JoshJarc
Copy link

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

  1. In code, provide a callback function for NetworkManager.Singleton.OnClientDisconnectedCallback on the client.
  2. In that callback function, print to the console the values for the function parameter and NetworkManager.Singleton.LocalClientId
  3. Start a server using NetworkManager.StartHost()
  4. Note the id passed in NetworkManager.Singleton.OnClientConnectedCallback
  5. Start a client using StartClient()
  6. After both are connected, disconnect the host.
  7. 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.

Screenshots

image

Environment

  • OS: Windows
  • Unity Version: 2022.3.16f1
  • Netcode Version: 1.7.1
@JoshJarc JoshJarc added stat:awaiting-triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Dec 29, 2023
@NoelStephensUnity NoelStephensUnity added duplicate and removed stat:awaiting-triage Status - Awaiting triage from the Netcode team. labels Dec 31, 2023
@NoelStephensUnity
Copy link
Collaborator

Hi Josh,

This issue was resolved in PR-2789 and will be included in the soon to be released v1.8.0 update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

2 participants