Strange behaviour Player 2 disconnect/reconnect [RPC calls]

Options
Hey folks!
I'm having some trouble making this work.
To explain the problem I've included a little graphic illustrating what happens in my game.
Basically, it's an FPS where players can shoot helmets off enemy players.
If a helmet is hit, the shooting player calls an RPC function which disables the helmet gameobject in the enemy's prefab instance.

It works perfectly fine for player 1 and 2 and even for a 3rd player who connects.
However, if player 2 disconnects and then reconnects, the helmet on player 1 is still enabled.

The RPC function's PhotonTargets is AllBuffered. Like I said, it works just fine if a Player 3 connects; in his game, he sees that both helmets on player 1 and 2 are gone.
If anyone knows anything about this, I'm asking for your help! :D

Comments

  • vadim
    Options
    Hi,

    I think confusion comes from the fact that there is no such thing as "reconnect" in PUN. Each connected player treated as new and can't inherit any properties of other player disconnected before including RPCs (which are discarded when player leaves, btw).
  • So how do you call RPC's for new players when one of the RPC's come from a disconnected player?
    Do I need to make a Helmet Manager script or something that keeps track of all connected players helmets?
    How would you go about this?
  • vadim
    Options
    All player RPC's are discarded as soon as player disconnects. Items owned by player discarded as well.
    Buffered RPC's of players already joined the room are called for new players.

    Not sure about Helmet Manager script since I don't know gameplay details.
    But room custom properties can help to keep game state shared between all clients.