MP Scoreboards?

I hope I am using the right title. In my game, I want a scoreboard displayed for each player connected to the room. This will display their score and username to each other player. I had a version of this working before but removed the code by mistake and now I can not figure out how I had it working before. Here is what it looks like:
https://puu.sh/BXfUa/3701e3b8a9.jpg

I want this UI to be created for each player that joins the room and is view-able to all others. Each player will have their own. This UI will also get destroyed when the player leaves. ATM I have it instantiated when the player joins but it only works for the master client and if you were in the room before a player joined. Meaning, if you joined first, you will see yours and every other ui. If you join second, you will only see yours and those who joined after you. Also, it doesn't display their players name and score.

Comments

  • Hi @Nargdev,

    since you already have this working for the local client and all clients that join later, I assume you already use the OnPlayerEnteredRoom and the OnPlayerLeftRoom callbacks. Besides those two you have to use the OnJoinedRoom callback, too. When this one gets called, you can use PhotonNetwork.PlayerListOthers to get all other clients that are already in the room and instantiate their UI prefabs locally.

    If you want to you can take a look at the PlayerOverviewPanel class from the Asteroids demo included in the PUN 2 package. It is not exactly the same as above but works similar. It also shows how the instantiated UI prefabs are stored and updated on the client.
Sign In or Register to comment.