I'm using Steamworks.net in a unity project with success, I can't create lobbies and retrieve a list.
I need to create a simple c# app in visual studio notifying me of users playing my steam game so I decide to take about the same code:
using Steamworks;
using System.Collections;
using System.Collections.Generic;
if (!SteamAPI.Init())
{
Console.WriteLine("Init failed !");
return;
}
Console.WriteLine("Steam initialized ");
var m_LobbyMatchList = CallResult<LobbyMatchList_t>.Create(OnLobbyMatchList);
void OnLobbyMatchList(LobbyMatchList_t list, bool bIOFailure)
{
uint numLobbies = list.m_nLobbiesMatching;
if (numLobbies <= 0)
{
Console.WriteLine("No lobby");
}
else
{
for (var i = 0; i < numLobbies; i++)
{
var lobby = SteamMatchmaking.GetLobbyByIndex(i);
var name = SteamMatchmaking.GetLobbyData(lobby, "name");
var nolevel = SteamMatchmaking.GetLobbyData(lobby, "nolevel");
var nplayers = SteamMatchmaking.GetNumLobbyMembers(lobby);
var maxplayers = SteamMatchmaking.GetLobbyMemberLimit(lobby);
if (name.Length == 0)
continue;
//var li=new Lobbyitem(name, lobby.m_SteamID, 0);
Console.WriteLine("Lobby "+i + name + " niveau "+nolevel+" "+ nplayers+"/"+ maxplayers);
}
}
}
while(true)
{
Thread.Sleep(5000);
Console.WriteLine("Request lobby list...");
SteamAPICall_t hSteamAPICall = SteamMatchmaking.RequestLobbyList();
m_LobbyMatchList.Set(hSteamAPICall, OnLobbyMatchList);
}
Everything seams to run fine except that OnLobbyMatchList is never called.
Can someone tells me what I am missing ? Nearly the same code works in unity in my game.
I'm using Steamworks.net in a unity project with success, I can't create lobbies and retrieve a list. I need to create a simple c# app in visual studio notifying me of users playing my steam game so I decide to take about the same code:
Everything seams to run fine except that OnLobbyMatchList is never called. Can someone tells me what I am missing ? Nearly the same code works in unity in my game.
Thanks