Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

PunRPC - Updating the UI in a lobby (doing something wrong)

$
0
0
So the UI has a list of players. Let's say it defaults to say "0" for the # of players.

Whenever a player joins the lobby, I want EVERYONE's UI to also read numOfPlayers++.

So the master client (M) joins, total players 1.
Another client (C) joins, total players 2.

Right now, I'm trying this (and it doesn't seem to work):
public override void OnJoinedRoom() 
{
base.OnJoinedRoom();
RpcUpdatePlayerUI();
}

[PunRPC]
void RpcUpdatePlayerUI()
{
int playerCount = PhotonNetwork.room.PlayerCount;
playerCountTxt.text = playerCount.ToString();
}
Results:
M = 1
C = 2

My guess is that Cwasn't a master client, so it didn't have permission to Rpc to the others, so it only assigned itself.

So with UNET, I could just [Command] to talk to the host to Rpc to others. How would I do the equiv. in Photon?

Viewing all articles
Browse latest Browse all 15755

Trending Articles