Skip to content

Wrong client ID passed to NetworkManager.OnClientDisconnectCallback #2799

@JoshJarc

Description

@JoshJarc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions