Hello.
I'm really new to developing multiplayer games so the question I will ask now may sound ridiculous to you.
I have a SteamManager.cs code and attached it to the files.
I have imported the Friends Invite Dropdown prefab into my project and can't find a way to make the Invite button send Lobby Invites to people.
Is there an easy way to do it ?
I saw in a tutorial that you can just use the Invite method which is included in LobbyManager.cs but since I'm not using it I need help with implementing one into my SteamManager.cs code.
#Invite Dropdown Prefab Invited (UserData) Event
1 messages · Page 1 of 1 (latest)
Never use SteamManager.cs
first thing that jumped out at me
First the logic of it
The code to send an invite to a lobby can be done from either the lobby data of the lobby you want to invite to or the user data of the user you want to invite.
So for example
From LobbyData
Assuming myLobby is a valid LobbyData of the lobby you want to invite them to
myLobby.InviteUserToLobby(thisUser);
From UserData
Assuming thisUser is the user you want to invite
thisUser.InviteToLobby(myLobby);
https://kb.heathen.group/toolkit-for-steamworks/unity/objects/classes/user-data#invitetolobby
The Friend Invite Drop Down
https://kb.heathen.group/toolkit-for-steamworks/unity/objects/ui-components/friend-invite-dropdown
So this UI element just raises an event when a specific friend is selected. You are expected to handle that event and then invite them
So for example if you assigned the following method to the Invited event
public void OnFriendInvite(UserData thisUser)
{
thisUser.InviteToLobby(myLobby);
}
Your next logicle question is how do you get "myLobby" and frankly that depends on your game and your UI. Be sure you have read the article on Steam Lobby 80% of new to Steam devs have missconceptions as to what a lobby is
https://kb.heathen.group/steam/multiplayer/matchmaking-tools
Anyway you would be doing this sort of thing in a menu or UI that is managing a lobby so you will already have this rather you have it from a LobbyManager component or maybe this is part of yoru Party UI so you can simply check for a party lobby first ... that might look like this
public void OnFriendInvite(UserData thisUser)
{
if(LobbyData.GroupLobby(out var myLobby))
thisUser.InviteToLobby(myLobby);
}
Or maybe this is a invite for a session lobby
public void OnFriendInvite(UserData thisUser)
{
if(LobbyData.SessionLobby(out var myLobby))
thisUser.InviteToLobby(myLobby);
}
Point is there are countless options that depend on your specific UseCase
and important think to understand is that a Steam Lobby is basically a chat room ... a player can be in more than 1 at a time
It is NOT part of your network setup and has many uses out side multiplayer
understandign that will help you expand how you think about Steam Lobby
Worth noting you can invite a user to a game not just a lobby so this UI element is useful for more than just lobbies