Skip to content

Inconsistencies in the on client connected and disconnected callbacks #1880

@NaolShow

Description

@NaolShow

Transport inconsistencies

So while moving from UNetTransport to UnityTransport I found that there is an inconsistencies between those two with the OnClientDisconnected callback (from NetworkManager). This only happens when being a client-only, so not the host and not the server.

Here's the difference between the two:

  • When using UNetTransport: The event is triggered when the local client is getting disconnected from the server (either kicked or failed connection approval)
  • When using UnityTransport: Same as UnetTransport BUT also triggers when the client shutdowns the network (and so disconnects intentionnaly)

This is a small inconsistencies, but it messed up with my game behaviour after moving to UnityTransport. The question is which one of the behaviour is the correct one?
For me, the most logical one is UnityTransport and so UNetTransport have a problem with the OnClientDisconnected event.

Other inconsistencies

Here it's the same, some inconsistencies, (not related to transport), but they are also annoying (I use workarounds in my game):

OnClientConnectedCallback:

  • In server(host or server only): Called when a client connects and passed the connection approval (including host) => This works
  • In client(host or client only): Same that the server, but this triggers only for local client => Works

OnClientDisconnectedCallback (here are the inconsistencies):

  • In server(host or server only): Called when a client disconnects BUT doesn't get called when the host disconnects => Inconsistencies with on ClientConnectedCallback
  • In client(client only): See the first part of my message (inconsistencies between transport) but it should logically have the same behaviour as the UnityTransport

I am using the latest Netcode release (1.0.0-pre.7)

Metadata

Metadata

Labels

No labels
No 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