PUN2 reconnect to wrong region code after leave room(after perform connect with region)

Options
Hi,

My game have a dropdown to allow player to change region after connected Master Client, so what I did is I disconnect the player and connect them to the region when OnDisconnected callback called with DisconnectByClientLogic, it work pretty well.

But then I noticed the problem is that after the user changed region and start a match making and left room, the PUN2 will reconnect with wrong region code and causing the game to disconnect again. Here the screenshot from debug log.

Capture.PNG

From the log I connect to au server with ConnectWithRegion, then after player left room the PUN connect to au/*

Comments

  • Tobias
    Options
    The regions au and au/* are the same. The /* indicates that the server can assign a "cluster". But there is only one, so there is no difference here.
  • TeohTC
    TeohTC
    edited January 2021
    Options

    @Tobias said:
    The regions au and au/* are the same. The /* indicates that the server can assign a "cluster". But there is only one, so there is no difference here.

    Hi,

    Thanks for your explanation, but is there any explanation why it will disconnect after player left room, it only happen if player change region after connected to server with connectwithsetting. I have done some debug and checked my code, the only place I call disconnect is when player trying to change region and the function for me to perform change server didn't print anything after player left room

  • Tobias
    Options
    Sorry for the late reply.
    PUN 2 should not disconnect. I mean, it does under the hood but only to switch between the game server and the master server. The LoadBalancingClient and PUN do not consider this a disconnect as such (as you end up being online on the Master Server).

    Maybe you put Debug.Log into LoadBalancingClient.Disconnect and check if that's being called. The console log will have a stacktrace, so you know which code called it?