SetInterestGroups doesn't do anything
Options
Hi,
I'm quite new to Photon, but I want to optimize the number of messages.
I'm trying to make my playerController instances only listen to specific groups, but whatever i do, other players are still listening to all movements even if they are in 2 separate channels.
What am I missing here? or is the OnPhotonSerializeView send to channel 0? how can i remove that?
Many thanks!
I'm quite new to Photon, but I want to optimize the number of messages.
I'm trying to make my playerController instances only listen to specific groups, but whatever i do, other players are still listening to all movements even if they are in 2 separate channels.
What am I missing here? or is the OnPhotonSerializeView send to channel 0? how can i remove that?
Many thanks!
void Update() { if(!PV.IsMine) return; int channel = (int)PV.InstantiationData[1]; List<byte> disable = new List<byte>(0); List<byte> activeCells = new List<byte>(0); if(channel == 1) { Debug.Log("channels: 1"); activeCells.Add((byte)1); disable.Add((byte)2); PhotonNetwork.SetInterestGroups(disable.ToArray(), activeCells.ToArray()); } if(channel == 2) { Debug.Log("channels: 2"); activeCells.Add((byte)2); disable.Add((byte)1); PhotonNetwork.SetInterestGroups(disable.ToArray(), activeCells.ToArray()); } move() } void FixedUpdate() { if(!PV.IsMine) return; move(); } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(this.rb.position); stream.SendNext(this.rb.rotation); stream.SendNext(this.rb.velocity); } else { networkPosition = (Vector2) stream.ReceiveNext(); networkRotation = (Quaternion) stream.ReceiveNext(); rb.velocity = (Vector2) stream.ReceiveNext(); float lag = Mathf.Abs((float) (PhotonNetwork.Time - info.SentServerTime)); networkPosition += (rb.velocity * lag); } }
0
Comments
-
Hi @Rolfinator,
Thank you for choosing Photon!What am I missing here? or is the OnPhotonSerializeView send to channel 0? how can i remove that?1 -
Hi @Rolfinator,
Thank you for choosing Photon!What am I missing here? or is the OnPhotonSerializeView send to channel 0? how can i remove that?
lol wow... probably tried so many different things that somewhere along the road that slipped away... thank you very much! works perfect now, thanks.0