Steamworks.NET
Steamworks.NET copied to clipboard
Lobby data returns empty on non-host clients
When creating a lobby, I use SteamMatchmaking.SetLobbyData() to store the host's Steam ID to allow others to connect, given that my networking solution's Steam transport uses Steam IDs to connect players. When I Use GetLobbyData() to retrieve this data on the host, it returns the value just fine. However, on other clients that are trying to join, it just returns an empty string ("").
I found a thread about this same issue from 2017 and it seems like it still isn't fixed. What's weird is that every tutorial I find uses the exact same method as me to store lobby data, so it seems like for whatever reason, it isn't a universal problem even if people have the exact same code.
Here is a link to the thread: https://forum.unity.com/threads/getlobbydata-returns-in-steamworks-setting-up-steam-lobby.1183024/
If you're running on Mac or Linux, make sure you switch the target platform back to your own after building for Windows. https://github.com/ValveSoftware/GameNetworkingSockets/blob/eb09e02ee3e5cfa0a409054492539e0449386f9d/include/steam/steamclientpublic.h#L1137
Nothing related to your issue but your use case also sounds odd
Steam Lobby has a concept of Set Game Server which will store server connection information on the lobby and raise callbacks for your lobby members to let them know when it first gets set
Note "Game Server" can be a peer or server doesn't matter, it can be ip/port or CSteamID or both doesn't matter
https://partner.steamgames.com/doc/api/ISteamMatchmaking#SetLobbyGameServer
I have the exact same problem. When clients try to join the lobby, the GameLobbyJoinRequesterd_t callback gets called and the callback..m_steamIDLobby has a value. Works so far. Then the LobbyEnter_t callback gets called and the callback.m_ulSteamIDLobby is an empty string.
EDIT: Calling SteamMatchmaking.RequestLobbyData(callback.m_steamIDLobby); before calling JoinLobby() fixes it for me.