I want to send/recieve in method OnPhotonSerializeView() only those players, who have some customProperty to reduce data traffic/ping.
Every player has customProperties "positionX" and "positionY". I try smth like that:
Am I on right way? Or this won't reduce data traffic/ping?
Thanks a lot![:) :)]()
UPD: This works (doesn't recieve data if distance is big), but I don't know how to check if this reduces client's traffic.
Every player has customProperties "positionX" and "positionY". I try smth like that:
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
stream.SendNext... //send data
...
}
else
{
object val;
if (PhotonNetwork.player.customProperties.TryGetValue("PositionX", out val) == true)
{
int posX = (int)(float)PhotonNetwork.player.customProperties["PositionX"];
int posY = (int)(float)PhotonNetwork.player.customProperties["PositionY"]; //get own client position
Vector3 myPosition = new Vector3(posX, posY);
Vector3 hisPosition = transform.position;
if (Vector3.Distance(hisPosition , myPosition ) > 200) //check if distance between us is big
{
return; //dont recieve data -> we don't waste some traffic to get data (is it true?)
}
}
stream.ReceiveNext... //continue getting data
...
}
Am I on right way? Or this won't reduce data traffic/ping?
Thanks a lot

UPD: This works (doesn't recieve data if distance is big), but I don't know how to check if this reduces client's traffic.