Host migration - sync issue

Options
Hi,

I have following problem:

- When player A creates a room and becomes a master client, He create some object ( O ) over a network (PhotonNetwork.Instantiate()) .
- When player B connects to this room, He gets object O instantiated properly. This works even if leaves the room and reconnects again.

but..

- When player A leaves the room while player B is still there ( B should become master client ) and joins the room again - then object O
is not instancing on player A scene :/

In my understanding - joining new master client game should work similar as joining the original one..

Please help me solve this one .. If You need any more info about how am I doing it - Ill explain in more details.

Thanks,
Stan

Comments

  • dontonka
    Options
    Hello Neciq.

    Here is my 2 cents.

    From my understanding when Player A will leave the room, Player B will indeed become master client, but i don't think player's A objects will be transferred to player B as they are owned by the Player A, so they are destroyed as you experiemented. I believe this is the intended behavior. You seems to need to create objects owned by the scene instead of the player if you want the behavior you mention.

    Also, when the player A leaves, it is not true that player B will re-join the room, it will simply become master from the server perspective, it will not trigger the same logic and callback as when he joined the room. In such case you will receive only one callback I believe called OnMasterClientSwitched.

    Cheers,
    Don T.
  • Neciq
    Options
    I have figured it out :) !!

    Instead of PhotonNetwork.Instantiate() (on first master client) I simply instantiate object O in the scene, assign it new view ID and keep this view id in CustomProperties - then when new player ( eg B ) joins - he also simply instantiate object O and assigns viewID from properties !!. The point is - master client should update object O all the time ( because it is my main game logic obj :D )

    Now whenever some new player joins, regardless if there is new master client - new player will create propper, synchronized instance of object O. !!

    Thanks for replay anyway , Cheers,
    Stan