How to sync Game Manager values with all the players?
The whole answer can be found below.
Try Our
Documentation
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.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How to sync Game Manager values with all the players?
BHS
2022-10-10 08:21:12
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?
Comments
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.
Back to top