Search Unity

[Help] Photon 2 | Raise Event does not work.

Discussion in 'Scripting' started by NicoProner, Feb 14, 2020.

  1. NicoProner

    NicoProner

    Joined:
    Jan 15, 2015
    Posts:
    1
    Hello everyone, I'm going straight to the point, I need to send an Event via Raise Event, but since the EventData.Code check does not match, then analyze if I was sending the event, and apparently it is not being sent. I went to the script "PhotonNetwork.cs" and put two Debug.Log in the Raise Event event, to check where the problem is and it turns out that the bool variable "OfflineMode" is always false, therefore it never saves the event code. My question is: Why doesn't that variable give true? And sorry for my bad English, it's not my mother tongue.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    [Code of Script "PhotonNetwork.cs"]

    public static bool RaiseEvent(byte eventCode, object eventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions)
    {
    Debug.Log("Call event RaiseEvent");//this if it runs
    if (offlineMode)
    {
    //this does NOT run
    Debug.Log("Offline Mode On, ok.");
    if (raiseEventOptions.Receivers == ReceiverGroup.Others)
    {
    return true;
    }

    EventData evData = new EventData { Code = eventCode, Parameters = new Dictionary<byte, object> { {ParameterCode.Data, eventContent} } };
    NetworkingClient.OnEvent(evData);
    return true;
    }
    else
    {
    Debug.Log("??"); //this if it runs
    }
     
unityunity