We are working on Steam invites for our title on Steam which uses photon networking. So far we have in game invites working perfectly, but we are unable to get the steam launch command to give us anything when a user is invited while not running the game.
When we return the Steam launch command while running in Steam, it’s just a blank string. Anyone have any experience with this?
Here is the snippet of debug code we are using which displays the launch command on GUI. We run this in a test app on steam and have another user invite to game. Nothing is displayed on the command line out.
if (SteamManager.Initialized)
{
string CommandLine = "";
int ret = SteamApps.GetLaunchCommandLine(out CommandLine, 260);
GUI.Label(new Rect(Screen.width / 2, Screen.height -30, 800, 30), "Command line is: "+CommandLine);
}
Hello, I know this is an old post but I got lost on this for 20 minutes of googling with no luck and thought the answer might be useful to someone. The steam api is a bit vague and tells you to get them out with the api, however that returns empty.
So, I did some googling, and tried a few different methods via the SteamAPI.
No luck, but it occured to me that I am a fool…
These are command line arguments. And sure enough they did exist if you looked at them in task manager when you start your game via an invite. Once i saw that I face palmed.
You can get them out with something like the following
// get your command line arguments
var args = System.Environment.GetCommandLineArgs();
// we really only care if we have 2 or more if we just want the lobbyid.
if (args.Length >= 2)
{
// loop to the 2nd last one, because we are gonna do a + 1
// the lobbyID is straight after +connect_lobby
for (int i = 0; i < args.Length - 1; i++)
{
if (args[i].ToLower() == "+connect_lobby")
{
if (ulong.TryParse(args[i + 1], out ulong lobbyID))
{
if (lobbyID > 0)
{
// do something with your lobby id
}
}
break;
}
}
}