Search code examples
c#unity-game-enginesteamworks-api

Steamworks: Retrieve CSteamID steamIDLobby


Unity, C#, Steamworks API

I've created a lobby and now need to be able to invite someone through the GameOverlay. To invite someone I need the 'steamIDLobby' value, but I can't seem to retrieve it, I have no clue how.

Currently I've got:

    private void OnLobbyCreated(LobbyCreated_t response)
    {
        print("Lobby created: " + response.m_ulSteamIDLobby);
        Lobby = new Lobby(response.m_ulSteamIDLobby);
    }

The problem here is that I get a ulong 'SteamIDLobby' while I need a CSteamID. How can I retrieve the CSteamID variant of the SteamIDLobby variable?


Solution

  • Okay, so a few hours after posting this question, I figured out the answer. It's kind of stupid how I lost so much time trying to figure this out, so I hope my answer can help other developers to continue fairly quick.

    When using the Steamworks API you can just cast ulong variables to CSteamID... So in my case, all I had to do was:

        Lobby = new Lobby((CSteamID)response.m_ulSteamIDLobby);