Search Unity

Question Does data sender receive lobby events that send from him?

Discussion in 'Lobby' started by orcunsari, Jun 19, 2023.

  1. orcunsari

    orcunsari

    Joined:
    Jul 21, 2016
    Posts:
    23
    Hi, I subscribed lobby events and trying to send custom lobby data but I can't receive the data I send through lobby event callbacks. The other lobby members do receive events but I can't somehow. Shouldn't I receive the data ?
     
  2. bartj-unity

    bartj-unity

    Unity Technologies

    Joined:
    Sep 9, 2021
    Posts:
    26
    If you are using 1.1.0-pre.5, this was just changed to not trigger updates for a user's own changes. If you are using a previous version, then yes, you should still be seeing those callbacks.
     
  3. aliajami

    aliajami

    Joined:
    Jan 5, 2023
    Posts:
    5
    @bartj-unity I was also facing the same issue I'm on 1.1.0-pre.5 as well, is this change permanent?
    Any news on when the official release is happening for lobby 1.1? I can't wait to update my game to use events but I need to wait for the official release
     
  4. bartj-unity

    bartj-unity

    Unity Technologies

    Joined:
    Sep 9, 2021
    Posts:
    26
    That change is expected to be permanent. The reasoning for it was that if you're making a local change, you can (and should) just apply any logic around your lobby updates immediately instead of relying on, and waiting for, the Lobby service to send you an update event. Timing for the next official release is still TBD.
     
    aliajami likes this.
  5. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    why make it not trigger the events ? sometime we just want write same logic for both host and member. Just add the config that could be enable it or disable it
     
    Last edited: Jul 28, 2023
  6. Liam-C

    Liam-C

    Joined:
    Mar 6, 2017
    Posts:
    18
    +1. This change seems like the wrong API design decision to me.

    It's very likely that multiple different objects will be listening to changes to the lobby. If the event is triggered for both local clients and remote clients then a UI object displaying the value only needs to listen to one changed event. And logically it makes perfect sense that the OnXChanged event should be triggered regardless of who changed X. It's not called OnXWasChangedByARemoteClient.

    With this change we have to add extra logic to trigger the events manually when changed locally, or every time we update data locally we have to also manually update the other objects using that data. It went from one code path to listen to data changes to 2-* code paths, making it more laborious and error prone to work with.
     
    MalyaWka, Coldsandwich189 and DatCong like this.
  7. mcanfield_unity

    mcanfield_unity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    13
    The ability for the local player to receive its own events was changed, but will be enabled by a flag added in the next (unreleased version). The PR has already been merged on master and will be part of Lobby 1.2.0
     
    Liam-C likes this.
  8. ArthurAtUnity

    ArthurAtUnity

    Unity Technologies

    Joined:
    Aug 9, 2022
    Posts:
    9
    Lobby 1.2.0 has now been released !

    You can configure Lobby to send players their own events like so
    Code (CSharp):
    1. (LobbyService.Instance as ILobbyServiceSDKConfiguration).EnableLocalPlayerLobbyEvents(true);
    After this configuration is set, the local player will be receiving its own events.
     
    Liam-C likes this.