Updating Score over Photon Network

So I have been running around in circles for over a week now and I can't get the score change to work.

And with "work" I mean initiate the score change when it happens... not on a player turn change.

At around 20 seconds into the below clip the yellow disc hits the blue disc.

Now when it stops moving, the "15" written in red (P2 Score) should immediately flip to "10"...

But it only changes, the moment the other player turn is current and the disc moves

I have tried so many different ways and means, transferred ownership , used photnView .IsMine which didn't work either.

So I could use another pair of eyes on this, I have made a pastebin with snippets of the code to give you an idea as to the flow (but again the code functions,it's just that it doesn't update immediately)


Thanks in advance for your time and effort!


  • This might be a task for Custom Player Properties. In it, you can store the highscore independent from a players move / turn. One of the clients needs to rule that points are awarded and then updates the property for a player.

    You could also use Room Properties (and use keys "scorePlayer1" or shorter: "sp1" for example).

    Last but not least, there are Utility Scripts in the PUN package and one is the ScoreExtensions. So you can use AddScore and GetScore right on the Player class.

  • Thanks Tobias!

    The scoring is not a highScore, but the scoring of the game which can and probably will change at every turn.Basically the game loop is that the first person who gets to a 100 points wins.

    It's strange to me that everything runs properly on the first turn and score gets updated across the network, but once player 1 affects the disc of player 2 (and vice versa ) it doesn't work anymore ... so I really hope I can fix this with customplayer properties, as it is a maddening thing I have been struggling with for more than a week now :)

  • Custom properties don't work either.

    It seems like if there are 2 scenes ... and in scene 1 player 1 gets control over player 1 discs and in scene 2 the same goes for Player 2.

    And that they each control their own score and won't allow it to be set remotely.

    because no matter what I do ...photon won't allow me to set values on the other players disc and vice versa...why is that?

    It is really maddening, because this is teh final thing I have to do on teh Photon side and it just won't effin budge

  • Custom Properties don't mind scenes.

    Photon doesn't allow everyone to set everyone's score because this is hard to control when done concurrently. Just have each player set the own score and you're good. I don't get the problem, really. You synced the move / shot and why shouldn't the shooting player also set the score?

  • My thoughts exactly ... yet it has been two weeks now and I still haven't figured out what is going wrong.

    What I have done is that with each turn, I transfer ownership of all the discs to the player who's turn is up.

    And then use an "IsMine" IF check to control who sets the score.

    But no matter what I do, it won't budge... the best result I get is when I use an if check based on who's the masterclient (or not), but then I get a delay in score (which makes sense ) and the score of opposing discs gets set when the opposing player has its turn.

    This week I am swamped with stupid workstuffs , but in my next try I am going to do an if check based on explicit ownerid...

    Who knows, maybe after a few days not looking at the code , I see (probably my) mistake in the code