.Net Callbacks

PUN and Photon Realtime .Net SDKs provide a set of callback interfaces that you can implement in your classes:

  • IConnectionCallbacks: connection related callbacks.
  • IInRoomCallbacks: callbacks that happen inside the room.
  • ILobbyCallbacks: lobby related callbacks.
  • IMatchmakingCallbacks: matchmaking related callbacks.
  • IOnEventCallback: a single callback for any received event. This is 'equivalent' to the C# event LoadBalancingClient.EventReceived.
  • IWebRpcCallback: a single callback for receiving WebRPC operation response.
  • IPunInstantiateMagicCallback: a single callback for instantiated PUN prefabs.
  • IPunObservable: PhotonView serialization callbacks.
  • IPunOwnershipCallbacks: PUN ownership transfer callbacks.

All callback interfaces except IPunInstantiateMagicCallback must be registered and unregistered. Call PhotonNetwork.AddCallbackTarget(this) and PhotonNetwork.RemoveCallbackTarget(this).

For example in Unity, you could use the MonoBehaviour's OnEnable() and OnDisable().

If you extend MonoBehaviourPunCallbacks make sure to call the base class methods if you override OnEnable() and OnDisable().

To Document Top