Skip to content

ConnectedClients.Count hasn't been updated" when OnClientDisconnectCallback is triggered #2927

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
agalloch21 opened this issue May 16, 2024 · 0 comments · Fixed by #2941
Closed
Assignees
Labels
priority:high This issue has high priority and we are focusing to resolve it stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report

Comments

@agalloch21
Copy link

Description

I add listener functions for both OnClientConnectedCallback() and OnClientDisconnectCallback() to update client amount when clients connect or disconnect.

Inside OnClientConnectedCallback(), the NetworkManager.Singleton.ConnectedClients.Count is correct while it's wrong inside OnClientDisconnectCallback()

Reproduce Steps

  1. Client: StartClient()

  2. Server: OnClientConnectedCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has proper amount of clients which is 1

  3. Client: Shutdown() or just close app

  4. Server: OnClientDisconnectCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has WRONG amount of clients which is still 1 rather than 0

Environment

  • OS: macOS Sonoma
  • Unity Version: 2022.3.20
  • Netcode Version: 1.8.1
@agalloch21 agalloch21 added stat:awaiting-triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels May 16, 2024
@fluong6 fluong6 added priority:high This issue has high priority and we are focusing to resolve it stat:import Status - Issue is going to be saved internally stat:imported Status - Issue is tracked internally at Unity and removed stat:awaiting-triage Status - Awaiting triage from the Netcode team. stat:import Status - Issue is going to be saved internally labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high This issue has high priority and we are focusing to resolve it stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report
Projects
None yet
3 participants