Global event no being received on self.

I have a game which as the host there is a level transition event. The problem is when the host creates and send the event, the host doesn't receive the event.

var levelEvent = LoadLevel.Create(Bolt.GlobalTargets.Everyone); levelEvent.Ready = true; levelEvent.Level = level; levelEvent.Send();

It seems anything but the sender receives the event.

Comments

  • Everyone means to send to all client connections.
  • That seems weird as there is also an all clients option.
  • Is there a way That you can send an event that the server also receives.
  • DirtyHippy
    DirtyHippy ✭✭
    edited June 2019
    Right. Sorry. I abstracted all of this in my own implementation a long time ago so I could use the loopback to send events to the server player just like clients so I don't remember all of this that well.

    It does look like "everyone" raises it to clients and then locally. The code is in EventDispatcher if you wanted to parse out what all the different options are doing.
  • Strange I have tried a few examples of my event listener

    public class NetworkSceneManager : Bolt.GlobalEventListener { public override void OnEvent(LoadLevel evnt) { Debug.Log("Event"); } }

    If I start a single player Server using BoltLauncher.StartSingleplayer this event fires.

    But if is tart a normal server, If I fire events as the server that target Everyone or OnlyServer this event doesn't fire.

    I feel like I am missing something at server startup to say that the server should receive events or something.
  • So i have gotten it working. But strangely the network event only work if I put the [BoltGlobalBehaviour] on the class. Even if the class is on a unity object. It still wont register the events with out this attribute.

    Any ideas why.