Using GetScore() to continuously synchronize scores of two players?

Options
Hi there -

I've shipped Unity games before, but this is my first PUN experience, hence I'd be ever so much appreciative of your help.

Use case: I'm looking to make a simple score attack game. Two players join the room, game launches, users start accruing score, the one with the highest score in the end wins. However, each player should be able to see the other player's score in real time (or close to it).

After doing some research, I tried using the GetScore() sample that comes with the SDK. Generally, it works, but I do have the following questions:
  1. Is there a way to automate score retrieval for the other user - e.g. make the client detect that a score change event has occurred and call GetScore() on the user in question? Otherwise, to keep the score current, I can simply run a coroutine that queries it every second (is it too much, by the way?) - but it does feel terribly ham-handed and brute forced. I guess I'm looking for something more elegant, like a delegate callback equivalent?
  2. Am I actually going about this the optimal way? Later on, I can totally see myself adding additional progression-related information (like, where the other user is distance-wise, etc).
Thank you ever so much for any feedback. After some two years of Unity, I feel confident enough to tackle the client side and BaaS integrations, but multiplayer is just a whole different ballgame!

Cheers,
George

Comments