Steamworks.NET
Steamworks.NET copied to clipboard
When I'm using Steamworks, except for not calling functions like Callback<LobbyCreated_t>.Create(OnLobbyCreated);
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
}
}
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()