Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

When I'm using Steamworks, except for not calling functions like Callback<LobbyCreated_t>.Create(OnLobbyCreated);

Open shineforwu opened this issue 10 months ago • 1 comments

I'm using Godot version 4.4 with the .NET version . I'm using .NET 8, and the version of Steamworks.NET is Version="2024.8.0".

After I initialized it with SteamAPI.Init(), I registered the callback function:

lobbyEnterCallback = Callback<LobbyEnter_t>.Create(OnLobbyEnter); 

Then,

SteamAPICall_t hSteamAPICall = SteamMatchmaking.CreateLobby(lobbyType, maxMembers); 
In the public override void _Process(double delta) /// [the frame function in Godot], 
{
 SteamAPI.RunCallbacks(); 
}

I implemented SteamAPI.RunCallbacks(); However, after I called CreateLobby, it didn't enter the callback function.

private void OnLobbyCreated(LobbyCreated_t callback)
    {
      
        if (callback.m_eResult == EResult.k_EResultOK)
        {
          
            LobbyID = new CSteamID(callback.m_ulSteamIDLobby);// Get the id


        }
        else
        {
          
            // Todo
        }
    }

shineforwu avatar Mar 07 '25 17:03 shineforwu

The SteamAPICall_t that CreateLobby is returning means that it's a CallResult (specific handler function) rather than a Callback which is a general sink for out of bound delegates.

So you'll probably need to swap LobbyEnter_t over to a CallResult and bind the SteamAPICall_t into it with Set()

rlabrecque avatar Mar 09 '25 21:03 rlabrecque