Initialization

Before calling any Discord Social API, the SDK must be initialized with your Discord application ID.

1. Create a DiscordSocialSettings asset #

Open Project Settings › Player › Discord Social and set your applicationId (from the Discord Developer Portal) and, optionally, enable debugLogging.

2. Add the InitializeDiscordSocial component #

Add Heathen.DiscordSocialIntegration.InitializeDiscordSocial to a persistent GameObject in your first scene. It reads the DiscordSocialSettings asset and calls DiscordSocialApp.Initialize automatically, and also exposes Inspector/UnityEvent-wireable wrappers for Connect and GetProvisionalToken if you’d rather trigger those from UI instead of code.

3. Connect #

Call DiscordSocialApp.Connect (or its Task/UniTask overloads) to start the OAuth flow and establish a session. Once connected, the rest of the API — rich presence, lobbies, relationships, guilds, voice — becomes available.

All Discord Social code is compiled behind the DISCORDSOCIAL scripting define, which is set automatically via a versionDefine once Discord’s own com.discord.partnersdk package is present in your project.

Rate This Article!