OnEvent() not getting event from OpRaiseEvent

I'm using LoadBalancingClient, and my class derives IPhotonPeerListener.
I'm using Unity.

I wait till ConnectToRegionMaster, OpJoinLobby and OpJoinOrCreateRoom are true.
And they are, I'm using Debug.Log to check.

Then once client is connected to Server/Lobby/Room,
I use this:

if (Input.GetKeyDown(KeyCode.B))
RaiseEventOptions r = new RaiseEventOptions();
r.Receivers = ReceiverGroup.All;
client.OpRaiseEvent((byte)1, new HashTable(), true, r);

But pressing B does nothing.
This is how my OnEvent looks like:

public void OnEvent(EventData eventData)
Debug.Log("Event: " + eventData.Code);

I would expect to see "Event: 1" on Debug Log,
but it shows nothing. So OnEvent is not receiving the Event.
What could be the problem?


  • Sorry for double post, didn't found an Edit button:

    I'm using Input.GetKeyDown inside the Update() method.
    Also client.Service() is on update method as well.
    (client is the LoadBalancingClient).
  • Just checking random posts for replies. This didn't get one - sorry!

    When you use OpRaiseEvent(), it will send the event to the other players only. It's not mirrored locally by default.
    Set RaiseEventOptions.Receivers = ReceiverGroup.All for OpRaiseEvent, to send an event to everyone (including the sender).

    Use this only if you want approximately the same timing on the sender, as on the rest of the receivers. Otherwise, you can locally call OnEvent(), if you want to channel messages through the normal incoming workflow.