LaunchContext
public sealed class LaunchContextNamespace SideHustle
Passed to a gamemode’s launch callback. Carries who is launching (host / client / singleplayer) and, for multiplayer, the lobby id. The gamemode calls ReturnToHub when it is finished so Side Hustle can restore the menu.
Example
One callback for every role, reading a host setting:
static void Start(LaunchContext ctx){ int seconds = ctx.Multiplayer?.GetInt("len", 30) ?? 30; // null in singleplayer if (ctx.Role == SessionRole.Host) { /* start the round */ } // later, when the gamemode is done: ctx.ReturnToHub();}Properties
Section titled “Properties”Descriptor
Section titled “Descriptor”public GamemodeDescriptor Descriptor { get; internal set; }Type: GamemodeDescriptor
The descriptor being launched.
IsHost
Section titled “IsHost”public bool? IsHost { get; internal set; }true = host, false = client, null = singleplayer.
LobbyId
Section titled “LobbyId”public ulong LobbyId { get; internal set; }Steam lobby id for multiplayer; 0 for singleplayer.
IsSingleplayer
Section titled “IsSingleplayer”public bool IsSingleplayer { get; }True when this is a singleplayer launch.
public SessionRole Role { get; }Type: SessionRole
Added in 3.0.0
Who the local player is in this session; the same information as IsHost as an enum. Since 3.0.0.
PlayerCount
Section titled “PlayerCount”public int PlayerCount { get; internal set; }Added in 1.1.0
Players currently in the lobby (1 for singleplayer).
HostName
Section titled “HostName”public string HostName { get; internal set; }Added in 1.1.0
The host’s display name: their session alias when they set one on the Host form, else their Steam persona. On a client it is read from the lobby (sh_host_name), which the host writes the same way. Null for singleplayer.
HasPassword
Section titled “HasPassword”public bool HasPassword { get; internal set; }Added in 1.1.0
True if the lobby was created with a password.
Multiplayer
Section titled “Multiplayer”public Multiplayer.MultiplayerInfo Multiplayer { get; internal set; }Type: MultiplayerInfo
Added in 1.1.0
The full multiplayer payload (max players, gamemode name, the host’s free-form config blob, …). Null for singleplayer. Use this to pass gamemode-specific settings from host to clients.
Methods
Section titled “Methods”ReturnToHub
Section titled “ReturnToHub”public void ReturnToHub()Call this from your gamemode when it is done (e.g. the player clicks “Back”). Side Hustle restores the main menu and re-shows the hub. Only the first call counts: once the session was ended - by this call or by Side Hustle aborting it - later calls are ignored and logged.