question regarding OnEventCall
Options
Hello:
I am trying to do the register event just as the page http://doc-api.exitgames.com/en/pun/cur ... a792146e50
When I register the handler in OnJoinedRoom() it always tells
"operator += cannot not applied to operands of type PhotonNetwork.EventCallBack and method group"
I am using PUN(not PUN+), and just wondering where went wrong.
thanks
I am trying to do the register event just as the page http://doc-api.exitgames.com/en/pun/cur ... a792146e50
When I register the handler in OnJoinedRoom() it always tells
"operator += cannot not applied to operands of type PhotonNetwork.EventCallBack and method group"
I am using PUN(not PUN+), and just wondering where went wrong.
private void OnEventHandlerTest(byte eventCode, object content, PhotonPlayer sender) { Debug.Log("OnEventHandlerTest"); } void OnJoinedRoom() { PhotonNetwork.OnEventCall += this.OnEventHandlerTest; }
thanks
0
Comments
-
HI,
Method must exactly follow delegate signature:
public delegate void EventCallback(byte eventCode, object content, int senderId);
But you have PhotonPlayer instead of int in your method 3rd parameter.0 -
vadim wrote:HI,
Method must exactly follow delegate signature:
public delegate void EventCallback(byte eventCode, object content, int senderId);
But you have PhotonPlayer instead of int in your method 3rd parameter.
Thanks. Now I finally get the handler registration working.
I would say that please update the PhotonNetwork.RaiseEvent example part in all format of document if it is possible.
The third parameter in that example is always "PhotonPlayer sender" in every doc.private void OnEventHandlerTest(byte eventCode, object content, int senderId) { Debug.Log(" now it works "); } void OnJoinedRoom() { PhotonNetwork.OnEventCall += this.OnEventHandlerTest; PhotonNetwork.RaiseEvent( (byte)123, null, false, null); }
0 -
I changed the doc. Thanks for pointing that out. The next update will fix this description.0