Master client never calls any raised event
Options
Hello guys,
i created a helper class which contains a dictionary full of codes and multicast-delegates for my events:
This gets called in OnJoinedRoom-Method. The connectionStateDetailed is always Joined at this moment.
By default i raise my events using
I hope you guys have some ideas why the eventsystem works for everybody but not for the masterclient.
Thanks
i created a helper class which contains a dictionary full of codes and multicast-delegates for my events:
private static Dictionary<byte, EventDelegate> events = new Dictionary<byte, EventDelegate>();If any event gets raised there is this one single method for executing the correct delegate:
private static void OnEvent(byte eventcode, object content, int senderid) { if(!events.ContainsKey(eventcode)) { Debug.LogError("Tried to call unknown event with code: " + eventcode); return; } var dele = events[eventcode]; if(dele != null) { PhotonPlayer sender = PhotonPlayer.Find(senderid); dele(content, sender); } }The OnEvent-Method is registered using
PhotonNetwork.OnEventCall += OnEvent;.
This gets called in OnJoinedRoom-Method. The connectionStateDetailed is always Joined at this moment.
By default i raise my events using
In fact all this works absolutely fine as expected but only the master client recieves no single event. Even the simple expression
public static void RaiseEvent(byte eventCode, object arguments = null, bool reliable = true, bool all = true)
{
Debug.Log("Raising Event "+eventCode);
PhotonNetwork.OnEventCall(eventCode, arguments, PhotonNetwork.player.ID);
var options = RaiseEventOptions.Default;
if (all)
{
options.CachingOption = EventCaching.AddToRoomCacheGlobal;
options.Receivers = ReceiverGroup.All;
}
{
PhotonNetwork.RaiseEvent(eventCode, arguments, reliable, options);
}
}
PhotonNetwork.OnEventCall(199, null, PhotonNetwork.player.ID)does not have any effect. I tested this in Unity-Editor and as Standalone. Same results
I hope you guys have some ideas why the eventsystem works for everybody but not for the masterclient.
Thanks
0
Comments
-
If you wondered how i register my Methods:
public static void RegisterEvent(byte eventcode, EventDelegate dele) {
if(!events.ContainsKey(eventcode))
{
events[eventcode] = dele;
} else
{
events[eventcode] += dele;
}
}0