Strange problem with RaiseEvent
Options
Hello,
I have a strange error with PUN.
I use RaiseEvents, but there is one working bad, I use raiseevents like this:
I tried some different "configurations" but I think the code it's organized well.
Any suggestion?
I have a strange error with PUN.
I use RaiseEvents, but there is one working bad, I use raiseevents like this:
//The "content" array(I modify it from the unity inspector) public int[] content = new int[] { 0 }; //I put a "PhotonNetwork.OnEventCall += this.OnEvent;" so I receive the events void Awake() { PhotonNetwork.OnEventCall += this.OnEvent; } //The void where I receive the events private void OnEvent(byte eventcode, object content, int senderid) { if (eventcode == 0) { PhotonPlayer sender = PhotonPlayer.Find(senderid); // who sent this? byte[] selected = (byte[])content; foreach (byte unitId in selected) { Debug.Log(sender + " sent me the event " + eventcode + " containing " + selected[0].ToString()); } } } //I call this void from an UI button in the unity scene public void iLoveButtons(){ byte evCode = 0; bool reliable = true; PhotonNetwork.RaiseEvent(evCode, content, reliable, null); Debug.Log("¿Sent? + " + content[0].ToString()); }The problem is that I click the button, it's sended well, in console shows up that I sent the value I putted in the inspector of unity(70), but, in the other site the content[0] received is 0, then I send it again but from the other side, and it also shows up the received content[0] is 0, then I change the number in the inspector of the initial side(to 100), I send it again from the initial side, and the other side receives the number sent before(70).
I tried some different "configurations" but I think the code it's organized well.
Any suggestion?
0