0

I use UniRX (C#) which tries to resemble RXJS and others.

I try to make sure my network-dependent objects initialize after the data arrived.

Some of my objects get created and Subscribe later than MSGPlayerDataLoaded actually fired thus never proceed to OnPlayerDataLoaded.

    protected virtual void Awake()
    {
        MessageBroker.Default.Receive<BaseMessage>().Where(msg => msg.id == GameController.MSGPlayerDataLoaded).Subscribe(msg => OnPlayerDataLoaded());
    }

Is it possible to look into the past and grab old events since creation of MessageBroker?

From the documentation of RXJS I suspect that something like withLatestFrom could be of help, but it would need a dummy auxiliary stream that looks hacky.

  • If I understand right your question in the rxjs world you should look at `shareReplay` operator – Picci Apr 12 '20 at 19:57
  • @Picci I think you're right! I found Replay operator, but can't get how to apply to MessageBroker. Just chaining it with Subscribe does not work. – Sergey Yakovlev Apr 13 '20 at 18:27

0 Answers0