Toolkit for Discord Social is the interface and ergonomics layer over Foundation for Discord Social. The Foundation owns the SDK integration, the data model and every operation; the Toolkit adds ready-made uGUI components, prefabs, a demo game and UniTask forms so you can show Discord data, run a lobby and add voice without writing the plumbing.
Components #
Profiles and lists #
| Type | Purpose |
|---|---|
DiscordUserProfile, SetDiscordUserName, SetDiscordUserAvatar, SetDiscordUserStatus | uGUI components that display a user. Under a Foundation DiscordUserData they follow it and update when it changes. |
DiscordUserList | The friends list. It lists friends only, has an optional search field, and arranges friends into configurable groups (DiscordFriendGroup: a name, the statuses it holds, a “takes everyone else” tick and a start-collapsed tick). The defaults are Online, Away and Offline, with collapsible headers. |
DiscordUserGroup, DiscordUserGroupsDisplay | Group lists. |
DiscordGuildList, DiscordGuildProfile | Guild lists. Names only, which is all the SDK reports. |
IDiscordUserProfile, IDiscordGuildProfile | Contracts for your own custom displays. |
Sign in, status and connection #
| Type | Purpose |
|---|---|
DiscordSignInButton | One button that signs in and out. |
DiscordConnectionStatus | A sign in button and the connection state, with an optional Sign out button. |
DiscordStatusPicker | A dropdown to change your own status. It shows the current status, and the labels read Do Not Disturb and Invisible. |
DiscordTooltip | One shared tooltip used by the components. |
Lobby, invites and friend requests #
| Type | Purpose |
|---|---|
DiscordLobbySession | Creates or joins a Discord lobby, advertises it as the player’s activity so friends can be invited, announces to every member when the host has a session ready, and joins or leaves the lobby’s voice call. Discord carries no game traffic, the host’s own network does. |
DiscordLobbyMemberList, DiscordLobbyCode, DiscordJoinLobby | Members, a copyable lobby code, and join by code. |
DiscordInviteButton, DiscordInvitePrompt | Invite a friend, and accept an invite. The invite button explains itself with “Create or join a lobby first” when there is no lobby yet. |
DiscordFriendRequestList, DiscordFriendRequestRow, DiscordAddFriend | Pending requests with accept, decline and cancel, and add a friend by username. |
Voice #
| Type | Purpose |
|---|---|
DiscordVoiceBar | Join or leave voice, mute and deafen. |
DiscordVoiceParticipantList, DiscordVoiceParticipantRow | Everyone in the call, with a speaking light, a muted marker, a local mute and a volume slider. |
DiscordVoiceSettingsPanel | Microphone and speaker pickers, volumes, input mode, and the noise, echo and gain options. |
DiscordPushToTalkButton | Opens the microphone while held. |
DiscordVoiceSource, DiscordVoiceRouter, DiscordVoiceOutputToggle | 3D voice. DiscordLobbySession.VoiceOutput is Device (a normal call, the default) or UnityAudio, where each person plays through a DiscordVoiceSource on a GameObject such as a pawn, with the AudioSource’s own distance settings. |
Voice requires the players to have Discord. It is not a replacement for a full voice product, since there are no proximity or team channels built in. See Voice for the details.
Staying signed in #
Discord Social starts itself and remembers the player by default, so no initialiser or remember-sign-in component is needed in a scene. The token is kept by the Foundation’s PersistentDiscordTokenStore, encrypted with a key derived from the device. That is obfuscation, not a vault: it stops casual reading of the file, it does not protect against someone with access to the machine. If you need stronger protection, supply your own IDiscordTokenStore backed by platform-protected storage. DiscordRememberSignIn is kept for projects that turn Remember Sign In off.
UniTask #
DiscordSocialUniTask provides UniTask forms of the operations, for example DiscordSocialUniTask.CreateOrJoinLobby, plus ...UniTask extension methods on UserData and LobbyData. It builds only when UniTask is installed.
Samples #
- Prefabs: unstyled, ready-to-restyle uGUI prefabs (Sign In, User Profile, Friends List, Lobby and Voice, Guild List). See Prefabs.
- Demo Game (Template): a one-scene flow of sign in, friends, requests, lobby, invite, voice and session. See Demo Game (Template).
Requirements #
- Foundation for Discord Social 1.0.0 or newer.
- The Discord Social SDK 1.10.0 or newer (
com.discord.partnersdk), which you download from Discord and install yourself. It is never included in a Heathen package. See Install the Discord Social SDK. - The Heathen Game Framework, which the Foundation itself requires.
- UniTask is optional.
The Toolkit assemblies compile only when the Foundation, the SDK and the Game Framework are all present, so a project missing any of them gets no compiler errors, and a window explains what to install. Heathen Toolbox declares the dependency and can install the Heathen parts for you.
Getting started #
- Install the SDK, the Game Framework and the Foundation.
- Install the Toolkit and import the samples you want from the Package Manager.
- Set your Application Id in Project Settings, Subsystems, Discord Social.
- Drop a prefab from the Prefabs sample under a Canvas, or open the Demo Game scene, and press Play.
See the Initialization and Configuration pages for the set-up details.
Migrating from 0.3.x #
- Namespaces are unchanged and the moved scripts keep their GUIDs, so scenes and prefabs bind to them again once the Foundation is installed.
- If your code references the
Heathen.DiscordSocialassembly by name, also referenceHeathen.Foundations.DiscordSocial. GetSteamProvisionalTokenandGetSteamProvisionalThenConnectare removed. UseDiscordSteamLoginfrom the Foundation.- The
...UniTaskmethods onDiscordSocialAppmoved toDiscordSocialUniTask. The extension methods onUserDataandLobbyDatakeep their old names. - The settings page moved to Project Settings, Subsystems, Discord Social. Your existing settings asset is kept.
- The
User ListandUser Groupsprefabs are replaced by theFriends Listprefab, and the old Example Scene (manual token entry) is replaced by the Demo Game.
What has been tested #
Tested live against a Discord application: signing in through the browser, signing in again on the next launch with no browser, your own avatar and name, the friends list with correct statuses, friend requests, changing your own status from the dropdown (it updates on Discord), sending an invite (it arrived in Discord), creating a lobby, starting a session (with the whitelist accepting the lobby member and refusing a stranger), leaving the session and the lobby, and voice: two-way voice between two accounts, joining, leaving and rejoining a call, and the voice setting toggles including noise cancellation.
Not confirmed yet: accepting an invite (Discord showed “Join from a supported device” on the invite card for the test application, which may be an application configuration matter), joining by code, a session with several members, and hearing another person’s voice from a character through a 3D voice source. The Editor cannot read the current state of the noise, echo and gain switches, because the SDK needs RPC access to the Discord client for that, and the same is true with the Flatpak build of Discord on Linux. Treat the unconfirmed items as unverified and report what you find.