Overview
This guide will walk you through integrating the Discord Social SDK into an Unreal Engine project. By the end, you’ll have a project that can:- Authenticate users with Discord
- Set up logging and status monitoring
- Start the SDK and establish a connection
- Request the number of Discord friends the player has
- Set the player’s rich presence for your game
Prerequisites
Before starting, ensure you have:- Unreal Engine 5.1 or later
- A Discord application created in the Developer Portal
Step 1: Create your Discord application
- Go to the Discord Developer Portal and click New Application.
- Give your application a name and click Create.
- Copy your Application ID — you’ll need it in your code.
Step 2: Configure OAuth2 redirect URIs
- In your application settings, click OAuth2 in the sidebar.
- Under Redirects, add
http://127.0.0.1/callback. - Click Save Changes.
Step 3: Download the Social SDK for Unreal Engine
- In your application settings, click Downloads under the Discord Social SDK section in the sidebar.
- Select the latest version from the dropdown and download the SDK for Unreal Engine.
Step 4: Project setup
- Create a new project in Unreal Engine.
- In your project’s
Pluginsdirectory, create a folder calledDiscordSocialSDK. - Extract the SDK archive into the
DiscordSocialSDKfolder. - Add
DiscordSocialSDKto your project’sPublicDependencyModuleNamesin your.Build.csfile:
- Restart Unreal Editor to load the plugin.
Step 5: Initialize the SDK
Create a component or subsystem to manage the Discord client. Add the following initialization code:Step 6: Run callbacks
CallRunCallbacks from your game’s tick function:
Step 7: Account linking with Discord
This guide uses
Client::GetDefaultPresenceScopes, which requests the openid and sdk.social_layer_presence scopes. These enable core features like account linking, friends list, and rich presence.If your game also needs lobbies, voice chat, or direct messaging, use Client::GetDefaultCommunicationScopes instead. See the OAuth2 scopes guide for details.Step 8: Access relationships and set rich presence
When the client is ready, retrieve friends and set rich presence:Next steps
Creating a unified friends list
Build a unified friends list combining Discord and game-specific friendships.
Setting rich presence
Customize your game’s rich presence to show advanced information and game invites.
Managing lobbies
Bring players together in a shared lobby with text chat and voice communication.
Change log
| Date | Changes |
|---|---|
| March 17, 2025 | Initial release |