How to sync Game Manager values with all the players?

Hello,

So basically I have 2 cars in my scene which Photon will spawn when game starts, they both have a ready button.

In my Game manager script I have a readyCounter variable which checks if all the cars have pressed the ready button or not. when they do it performs an action, But when I press ready on a car it only checks for that car, and not others like readyCounter = 1, even though other cars have pressed the ready button as well.

My Game Manager doesn't have photonView its just there in the game scene by default.

Can someone tell me what to do here?

Answers

  • As usual, your objects can find the Game Manager and tell it they now exist or you could use the Game Manager to find them. That's not really a Photon topic.

    About networking this: I would use Custom Room Properties for this. You can use them to sync the state and there is even a feature called CAS (Check and Swap) which means you can make sure only the first player to use a car, can do that.

    Make sure someone is resetting each car's state in the Room Properties, even if others leave.