RPC Target
Comments
-
Hi,
Yes, you can pass PhotonPlayer in RPC() call to send RPC to this player only.
To find player by name, iterate PhotonNetwork.playerList and check 'name' property of each element.0 -
Thanks.
isn't there a simplier way? I think it will take too much time if there's about 1000 players in the room.0 -
PUN does not have optimized player search by name or ID. But why do you need that?
What does prevent you from keeping PhotonPlayer reference directly instead of name?
In worst case you need one auxiliary array or dictionary for PhotonPlayer references.0 -
my bad...
Thanks for your reply.0 -
Dear Vadim! This task is very important for me also. But the question is not resolved for me - I'm sorry Do You can write a simple example code for calling and for PRC executing of this task?vadim said:Hi,
Yes, you can pass PhotonPlayer in RPC() call to send RPC to this player only.
To find player by name, iterate PhotonNetwork.playerList and check 'name' property of each element.
For example:
private void CallingMethod() {
int player_ID = PhotonNetwork.playerList[ 0 ].ID; // Only as example
photonView.RPC( "RPC_PaintSpecificPlayer", PhotonTargets.???????, player_ID );
// PhotonTargets.??????? - what target need to be specified?
}
[PunRPC]
private void RPC_PaintSpecificPlayer( int player_ID ) {
// ????? How I can paint the cpecific player with this ID in special color?
}
Thank You if You can help me...0