Initialization

// Config: Engine - [], Toolkit - [v1.0.0]

Discord Social starts itself. Once the SDK is installed (see Install the Discord Social SDK) and your Application Id is set, there is nothing to add to a scene.

1. Enter your Application Id #

Open Project Settings, Subsystems, Discord Social and enter the Application Id from the Discord Developer Portal. The settings are stored in a DiscordSocialSettings asset at Assets/Settings/DiscordSocialSettings.asset and are included in builds. The start mode is Automatic by default, and Remember Sign In is on by default.

2. Press Play #

With the start mode on Automatic, the subsystem initialises Discord Social at start. A warning is logged if the mode is Automatic and no Application Id is set. If you prefer manual control, set the start mode to On Demand (the other modes are Automatic and Disabled) and call DiscordSocialApp.Initialize(appId) yourself, or add the optional Initialize Discord Social component (Heathen.DiscordSocialIntegration.InitializeDiscordSocial), which also exposes Inspector-wireable wrappers for connecting. A project with no settings asset still waits for DiscordSocialApp.Initialize.

3. Connect #

Call DiscordSocialApp.Connect(), or use a Sign In button (the DiscordSignInButton in the Toolkit’s Prefabs sample) to start the sign-in flow in the player’s browser. A successful return means a connection was requested. Wait for DiscordSocialApp.OnReady before using presence, lobbies, relationships, guilds or voice. With Remember Sign In on, later launches sign the player in again on their own with the saved token.

Compile gating #

All Discord Social code is compiled only when the Discord Social SDK package (com.discord.partnersdk 1.10.0 or newer) and the Game Framework are both present. Without them there are no compiler errors and a window explains what to install.

Rate This Article!