PhotonPlayer.CustomProperties set before PhotonView.Find(id) works
Hello,
I have a situation where if a new client connects, the OnPhotonPlayerPropertiesChanged is called for each player. One of the check I do is that I check if the player has an objective in the changed properties. This is simply an integer value. In my test, this value is not null (props[PlayerProperty.Objective] != null) and it has a certain value (25 in this case). This value is PhotonView's id. I also checked the player properties (not just the changed values) and it also contains this key value pair.
However, after I detect that this property indeed exists (value 25), my event executes, which down the line somewhere searches for the PhotonView with this id. PhotonView.Find(25). And this returns null.
Is this a bug? Is it supposed to act this way? Are there any workarounds? I need to get the PhotonView right after the player connects and detects a change in PlayerProps.
Everything works when players have already connected and the same thing happens. Then PhotonView.Find works perfectly. It's just the first frames of connection.
Thanks!
I have a situation where if a new client connects, the OnPhotonPlayerPropertiesChanged is called for each player. One of the check I do is that I check if the player has an objective in the changed properties. This is simply an integer value. In my test, this value is not null (props[PlayerProperty.Objective] != null) and it has a certain value (25 in this case). This value is PhotonView's id. I also checked the player properties (not just the changed values) and it also contains this key value pair.
However, after I detect that this property indeed exists (value 25), my event executes, which down the line somewhere searches for the PhotonView with this id. PhotonView.Find(25). And this returns null.
Is this a bug? Is it supposed to act this way? Are there any workarounds? I need to get the PhotonView right after the player connects and detects a change in PlayerProps.
Everything works when players have already connected and the same thing happens. Then PhotonView.Find works perfectly. It's just the first frames of connection.
Thanks!
1
Comments
-
As a side note, I noticed that player properties are set BEFORE the OnJoinedRoom is called. Why so?0
-
Receiving no answers, I conclude that this is simply a design decision and I have to come up with something else.
Thank you for your support0