OnPhotonPlayerConnect/Disconnect
Options
Hi all,
I just wanted some clarification on the parameters associated with:
public override void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
public override void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer)
The players set a particular key and value in the Lobby (category, string[]) via SetCustomProperties.
MasterClient will create a room, gets their key and value out and I can use said data.
When a player joins the room, I would expect that newPlayer contains that incoming player's CustomProperties, correct?
But when I try getting their key and/or value, it comes out as null.
However, that same incoming player can show me their key and value if I check locally via PhotonNetwork.player.CustomProperties...
Is there something I'm missing about those callbacks? I figured it would've been relatively straightforward if local PhotonPlayers can access their own CustomProperties and using the above method would sync their CustomProperties to the server.
I checked the doc but it's relatively sparse about the use of the parameters: https://doc-api.photonengine.com/en/pun/current/interface_i_pun_callbacks.html#a14eede4f84e088008e59fe63efb8775d
I'd appreciate any insights and/or inputs. Otherwise, I'm just gonna do this the old RPC fashion to sync up the data.
Thanks!
Andy
I just wanted some clarification on the parameters associated with:
public override void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
public override void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer)
The players set a particular key and value in the Lobby (category, string[]) via SetCustomProperties.
MasterClient will create a room, gets their key and value out and I can use said data.
When a player joins the room, I would expect that newPlayer contains that incoming player's CustomProperties, correct?
But when I try getting their key and/or value, it comes out as null.
However, that same incoming player can show me their key and value if I check locally via PhotonNetwork.player.CustomProperties...
Is there something I'm missing about those callbacks? I figured it would've been relatively straightforward if local PhotonPlayers can access their own CustomProperties and using the above method would sync their CustomProperties to the server.
I checked the doc but it's relatively sparse about the use of the parameters: https://doc-api.photonengine.com/en/pun/current/interface_i_pun_callbacks.html#a14eede4f84e088008e59fe63efb8775d
I'd appreciate any insights and/or inputs. Otherwise, I'm just gonna do this the old RPC fashion to sync up the data.
Thanks!
Andy
0
Comments
-
Another thing to note that's really confusing me:
I'm also setting some other properties in the Lobby not related to the data that I want. But those properties are showing up in those callbacks. The only difference is those properties have a value of booleans and this property that I want is string[]. So the value affects the visibility of the key? That doesn't really make sense in my knowledge of C# collections.0 -
Apologies,
Looking around in the scenes I found that a coworker of mine put the call to save the key/values on the wrong button in the scene. I've already incorporated an RPC logic about it and it works great, but that's rather embarrassing to make a post about it. I'm pretty sure the callbacks work just fine if it was able to show my other properties. Nevermind this thread.0