Collectible Items problem

Hello!

I try to create in my game collectible items (like health).
If a player collect, then hide for X seconds and show again.
So I thought about it, and i dont know what is the best logic for this. Okay i send rpc or in OnPhotonSerializeView but when another player join to the room i need to show or hide this item for the player.
How i can do this? What is the best way?

Thanks, Andor

Comments

  • Hi @MateAndor,

    there are multiple different ways to achieve what you want to have. If you want to use a custom OnPhotonSerializeView solution, new players who join later will always get an up to date game state. So this will work, but maybe isn't the best solution. You can also use RPCs and buffer those 'pick up events'. This will work, too, but maybe isn't the best solution again, because new joining clients will also receive very old buffered events, that are not up to date. Another option you have is to use the OnPhotonPlayerConnected(PhotonPlayer newPlayer) callback on the MasterClient. Following this approach the MasterClient can send the current game state (including the state of each collectible object) to the new player so that this player can update his local game accordingly.