Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetLobbyMemberData not triggering LobbyDataUpdate_t #409

Open
scottm85 opened this issue Apr 13, 2021 · 7 comments
Open

SetLobbyMemberData not triggering LobbyDataUpdate_t #409

scottm85 opened this issue Apr 13, 2021 · 7 comments

Comments

@scottm85
Copy link

scottm85 commented Apr 13, 2021

I may be misunderstanding how this is supposed to work, but according to the steam documentation SetLobbyMemberData should trigger a LobbyDataUpdate_t callback:

Each user in the lobby will be receive notification of the lobby data change via a LobbyDataUpdate_t callback, and any new users joining will receive any existing data.

I am only seeing this happen on the user that is setting their lobby member data. Example below:

public void OnLobbyEntered(LobbyEnter_t callback)
{
    if (SteamMatchmaking.GetNumLobbyMembers(lobbyId) % 2 == 0)
    {
        SteamMatchmaking.SetLobbyMemberData(lobbyId, Team.lobbyKey.ToString(), Team.Red.ToString());
    }
    else
    {
        SteamMatchmaking.SetLobbyMemberData(lobbyId, Team.lobbyKey.ToString(), Team.Blue.ToString());
    }
}

When a user enters a lobby I set the lobby member data to the team they will be on. If I manually check the member lobby data via RequestLobbyData or RequestMemberLobbyData it appears correct. However the following callback is only triggered for the user setting the member lobby data:

public void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
{
    CSteamID lobbyId = new CSteamID(callback.m_ulSteamIDLobby);
    int numPlayers = SteamMatchmaking.GetNumLobbyMembers(lobbyId);
    Debug.Log(numPlayers); // never even making it this far on other clients
    if (numPlayers >= networkManager.maxConnections)
    {
        MatchFoundPanel.GetComponent<Animator>().Play("Modal Window In");
    }
}

Is there something I'm missing here? Any help would be much appreciated. Thanks.

@rlabrecque
Copy link
Owner

Hey Scott, my initial question is what is the lifetime of the object holding on to the OnlobbyDataUpdated callback? It's definitely 'alive' in scope and around when the other user joins?

@scottm85
Copy link
Author

scottm85 commented Apr 13, 2021

Hey @rlabrecque. Correct, I have a SteamLobby script that is attached to my mirror network manager. The callback is defined globally in the class, initialized in Start(), and working for every client on their own OnLobbyEntered events.

Edit for clarity: Both methods/callbacks are in the same script, are 'alive', and in scope from the start of the application. There is no Destroy sequence for the object where they reside.

@scottm85
Copy link
Author

To add to this, if after the member lobby data has been set, I manually call GetNumLobbyMembers or GetLobbyMemberData, I can see the correct SteamUsers are in the correct lobby with the correct LobbyData and LobbyMemberData. I just can't seem to get the LobbyDataUpdate to trigger. I've been stuck on this, really confused for a while haha.

@scottm85
Copy link
Author

scottm85 commented May 5, 2021

Let me know if you have any follow up questions. I'm still stuck on this. Thanks.

@metalbird21
Copy link

Hello. Any new ideas on this issue? I am having the same problem.

@scottm85
Copy link
Author

@metalbird21 Nothing on my end yet. I'm still having the problem.

@scottm85
Copy link
Author

@metalbird21 - Did you ever come across a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants