Search Unity

After disconnection, Can the player control the game object he's using if he reconnects again?

Discussion in 'Multiplayer' started by rokugatsu29, Oct 23, 2017.

  1. rokugatsu29

    rokugatsu29

    Joined:
    Sep 25, 2017
    Posts:
    7
    Hi all,

    I am currently trying to find a way on how can the player rejoin the room and control the game object that he's using before being disconnected for at least 30 secs from photon.

    Thanks!
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Assuming it's a scene object (otherwise it will usually be destroyed when the player disconnects), I imagine the easiest way would be to request ownership transfer on the object when the player re-joins the game.
     
    rokugatsu29 likes this.
  3. rokugatsu29

    rokugatsu29

    Joined:
    Sep 25, 2017
    Posts:
    7
    @Munch2007 Thanks ! I guess I'll try this one :) , I actually spawn my player on the OnJoinedRoom() function of photon, so I think i'll have to add a boolean checking whether he has already spawned once , if yes, I'll request ownership transfer on my player object. Will see if this works :D