RaiseEvent listener not called

Options
Hello, I'm "new" in photon and started messing around with RaiseEvent. I've seen a video on Youtube about how to use them but when I'm trying to copy the same thing, It just doesn't work. I've attached a Photon view, and all but just doesn't wanna work.

In game, the code log incoming event with code 253 (from photon) but mine (with code 0) is just never printed. When I try to debug log the RaiseEvent line, it returns true (so it's sent) but never received.. Please help.
  1. private void Awake()
    {
    PhotonNetwork.NetworkingClient.EventReceived += NetworkingClient_EventReceived;
    }

    private void NetworkingClient_EventReceived(ExitGames.Client.Photon.EventData obj)
    {
    Debug.Log("Received : " + obj.Code);
    }

    public override void OnJoinedRoom()
    {
    if (PhotonNetwork.IsMasterClient)
    {

    object[] data = new object[] { false };
    PhotonNetwork.RaiseEvent(0, data, RaiseEventOptions.Default, SendOptions.SendReliable);
    Debug.Log("SENDING : " + false);
    }

    Debug.Log("Room joined");
    PhotonNetwork.LoadLevel("Game");
    //Debug.Log("Here" + PhotonNetwork.CurrentRoom.CustomProperties["ppt"]);
    }

Comments

  • gadoy
    Options
    bump up, nobody? I'm really stuck
  • Tobias
    Options
    The event will only go to the other players in a room. If there are any yet.
    Also, the receiving clients need to have the event receiver registered, of course. Maybe you log when you did that?
  • gadoy
    Options
    Thanks for the reply. So now every player in the room is receiving the event. But the question is, isn't there any way for the sender to receive it as well? if not, i'm just gonna do what i need from the event locally. But it's just to have a "proper" way to do it.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @gadoy,

    Thank you for choosing Photon!

    As @Tobias said, by default, the sender will not receive the event unless you explicitly do this for example via
    raiseEventOptions.Receivers = ReceiverGroup.All
    
    .
  • gadoy
    Options
    Thanks a lot!
    Here is the code :

    object[] data = new object[] { true};
    RaiseEventOptions options = new RaiseEventOptions();
    options.Receivers = ReceiverGroup.All;
    PhotonNetwork.RaiseEvent(0, data, options, SendOptions.SendReliable);