You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If you call ServerChangeScene(), it'll call NetworkServer.SetAllClientsNotReady() which sends NotReadyMessage to all clients:
foreach(NetworkConnectionToClient conn in connections.Values){
SetClientNotReady(conn);}
Even for those who hasn't authenticated yet! That's kind of strange. Because NotReadyMessage is a message for authenticated clients only, calling ServerChangeScene() when there're non-authenticated clients on the server would disconnect them:
Disconnecting connection: connection(0). Received message Mirror.NotReadyMessage that required authentication, but the user has not authenticated yet
UnityEngine.Debug:LogWarning (object)
I'm rewriting the way my game loads and connects to servers, but this problem has appeared. I was wondering why when the online scene is set and there's definitely a ServerChangeScene() call, everything works good and even when the host player isn't authenticated yet. Now, as I understand, it's because of the order in StartHost():
FinishStartHost() will add the host player to the list, which will be called much more later (after the scene is loaded). So ServerChangeScene() will not send the message to the host player. But when there's no online scene, FInishStartHost() will immediately add the host player, even before StartHost() stops executing.
And now after StartHost() when there's no online scene, I try to change scene with ServerChangeScene() and... there's already added host player, it's not authenticated yet... and the host client is disconnected. 👍
[IMPORTANT] How can we reproduce the issue, step by step:
You need a network manager with an authenticator set, so the host won't be authenticated immediately.
The manager should have no online scene set.
Then you call NetworkManager.StartHost();
Immediately after it, you try to change scene to another one: NetworkManager.ServerChangeScene(randomScene);
Then, maybe after some time the exception will be thrown, that will disconnect the host player.
Expected behavior
SetAllClientsNotReady() shouldn't set non-authenticated players not ready.
Desktop (please complete the following information):
OS: Windows
Build target: Windows (tested in the editor though)
Unity version: 2022.3.20f1
Mirror branch: uhm.. master I think. Downloaded from asset store (81.4.0 (but it seems like the code works the same like in the master branch now))
The text was updated successfully, but these errors were encountered:
publicstaticvoidSetAllClientsNotReady(){foreach(NetworkConnectionToClient conn in connections.Values){if(!conn.isAuthenticated)continue;
SetClientNotReady(conn);}}
Describe the bug
If you call ServerChangeScene(), it'll call NetworkServer.SetAllClientsNotReady() which sends NotReadyMessage to all clients:
Even for those who hasn't authenticated yet! That's kind of strange. Because NotReadyMessage is a message for authenticated clients only, calling ServerChangeScene() when there're non-authenticated clients on the server would disconnect them:
I'm rewriting the way my game loads and connects to servers, but this problem has appeared. I was wondering why when the online scene is set and there's definitely a ServerChangeScene() call, everything works good and even when the host player isn't authenticated yet. Now, as I understand, it's because of the order in StartHost():
FinishStartHost() will add the host player to the list, which will be called much more later (after the scene is loaded). So ServerChangeScene() will not send the message to the host player. But when there's no online scene, FInishStartHost() will immediately add the host player, even before StartHost() stops executing.
And now after StartHost() when there's no online scene, I try to change scene with ServerChangeScene() and... there's already added host player, it's not authenticated yet... and the host client is disconnected. 👍
[IMPORTANT] How can we reproduce the issue, step by step:
Expected behavior
SetAllClientsNotReady() shouldn't set non-authenticated players not ready.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: