Issues with Scoring and View
Options
Hey guys its NoobTimeAgain,
I'm trying to access the PhotonPlayer.player.GetScore() of the other client and I can't seem to find out how. Is there a way to access it without
foreach (PhotonPlayer photonPlayer in PhotonNetwork.PlayerList)
{
//blabla
}
?
Or is there a simpler way to do things?
I want something like
HP (Local) = 300
Enemy HP (other client) = 145
I'm trying to access the PhotonPlayer.player.GetScore() of the other client and I can't seem to find out how. Is there a way to access it without
foreach (PhotonPlayer photonPlayer in PhotonNetwork.PlayerList)
{
//blabla
}
?
Or is there a simpler way to do things?
I want something like
HP (Local) = 300
Enemy HP (other client) = 145
0
Comments
-
I think I found it, Should I put them in Teams then display only the Other Team score? Or is there a more efficient way to do it?
0 -
Hi @Christos,
it is enough to use the PunPlayerScores extension class, you don't have to use the PunTeams class. To get the score of all players, you would have to iterate through the PlayerList, as you have mentioned above. If there is only one other client in the room (two players overall), you can access the other client's score without iterating through the PlayerList. In this case you can use:PhotonNetwork.otherPlayers[0].GetScore()
; in PUN Classic orPhotonNetwork.PlayerListOthers[0].GetScore();
in PUN 2.
I have added both ways for PUN Classic and PUN 2 because I don't know which version you use. From the code snippet above it seems, that you have mixed up both version.1 -
Thank you @Christian_Simon I resolved it with the GetNext () so i can access the remote player. Searched in the DEMOs provided by PUN (rock-paper-scissors)0