Photon Unity Networking 2: IOnEventCallback Interface Reference

Photon Unity Networking 2

IOnEventCallback Interface Reference

Event callback for the Realtime Api. Covers events from the server and those sent by clients via OpRaiseEvent. More...

Inherited by PunTurnManager.

Public Member Functions

void OnEvent (EventData photonEvent)
 Called for any incoming events. More...
 

Detailed Description

Event callback for the Realtime Api. Covers events from the server and those sent by clients via OpRaiseEvent.

Classes that implement this interface must be registered to get callbacks for various situations.

To register for callbacks, register the instance via: LoadBalancingClient.EventReceived += instance. To stop getting callbacks, remove the instance via: -=.

Member Function Documentation

void OnEvent ( EventData  photonEvent)

Called for any incoming events.

To receive events, implement IOnEventCallback in any class and register it via AddCallbackTarget (either in LoadBalancingClient or PhotonNetwork).

With the EventData.Sender you can look up the Player who sent the event.

It is best practice to assign an eventCode for each different type of content and action, so the Code will be essential to read the incoming events.

Implemented in PunTurnManager.

Online Documentation  -  Dashboard  -  Support Forum Exit Games GmbH