com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

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

Open agalloch21 opened this issue 1 year ago • 0 comments

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 avatar May 16 '24 09:05 agalloch21