The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

RPC AllBuffered and OthersBuffered

2021-07-07 02:45:49

Hi, I have a problem and was wondering how i can fix this :

I have 3 players in a room. 1 master and 2 non-master.

Each player(non-master) has to ReadyUp. When each of the non master clicks on ReadyUp, the ReadyUp button for the becomes a "Waiting for other players" text (No more button). A "READY" text pops up on the player. Only when both non-master are ready can the masterclient click his "Deploy" button to the gamescene.

If the masterClient leaves the room, the masterClient is switched to 1 of the 2 non-master and for the new masterClient his "READY" fades and the text "Waiting for other players" becomes the "Deploy" button.

The problem is :

If i use AllBuffered or othersBuffered and the masterClient that left rejoins the same room, he won't be updated. He will still see the Ready text for both previously non-master players. Thus making it that if this non-master (previously masterClient) clicks on ReadyUp, he will see 3 "READY" players....which is not the reality.

Here is a piece of my code :


2021-07-07 09:20:23

if this non-master (previously masterClient) clicks on ReadyUp, he will see 3 "READY" players

Your code should probably only count the players who are active in the room and not count the Master Client (no matter who it is).

I would recommend using custom properties instead of buffered RPCs. You only want to sync a value per player and it should not change all that often. RPCs can be buffered more than once, posing a risk of filling the event buffer, which is hard to debug / notice.

The Asteroids Demo has a screen to show the ready state, if you are looking for inspiration.

Back to top