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
429
forks
source link
ConnectedClients.Count hasn't been updated" when OnClientDisconnectCallback is triggered #2927
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
Client: StartClient()
Server: OnClientConnectedCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has proper amount of clients which is 1
Client: Shutdown() or just close app
Server: OnClientDisconnectCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has WRONG amount of clients which is still 1 rather than 0
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
Client: StartClient()
Server: OnClientConnectedCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has proper amount of clients which is 1
Client: Shutdown() or just close app
Server: OnClientDisconnectCallback() gets triggered, NetworkManager.Singleton.ConnectedClientsIds has WRONG amount of clients which is still 1 rather than 0
Environment