This plugin is designed for users of Unreal Engine 5. It will help you to create a discord presence for your game like this :
- LouisRaverdy (OP: https://github.com/LouisRaverdy/DiscordRPC)
- Base plugin with Discord SDK intergation
- Lewis/CusYaBasic (Me)
- 5.3 update
- Fix type error with TimeStamps
- Added
GetStartTimeStamp
function - Created
DiscordGameInstance
class - Combind initial setup into one node
SetDiscordPresence
- various minor fixes
- Dowload this repostory
- Extract the repo
- Copy all content to your plugin project (YourProject/Plugins)
- Make sure you are register on Discord developer website
- Create your application and copy your Application ID
- Open your project and enable the plugin
Version 5.2 has changed a little bit. it now has DiscordGameInstance
class which handles most of the logic for you; streamlining the process, making it much faster to get up and running.
- You need to inherit your
GameInstance
class fromDiscordGameInstance
:
1.B) If you're using unreals default GameInstance
You'll need to create your own and inherit it from DiscordGameInstance
then set your project to use that class in your project settings:
I called my instance I_GameInstance
(but just set it to whatever yours is called):
- Now that we are inheriting from
DiscordGameInstance
, we can set out App IDs. Simpily override eventinit
and callSetAppIDs
while passing your IDs into the params:
Note : AppID IS REQUIRED, Steam is OPTIONAL
There are two ways of setting presence, SetBasicPresence
and SetAllPresence
; Basic sets just the need to know features, lick icon, state, details and time elasped. Whereas - All sets all values that are in the DiscordPresence
struct.
So anytime you need to update the presence info call any of these nodes:
Finally, once we have set our basic/all presence we can send it to the discord API using SetDiscordPresence
:
SetDiscordPresence
also has a clear function build into it to clear the presence during runtime if you need to switch it when you switch maps/activities:
You'll no longer have to override event Shutdown
as this is already done in code for you:
You no longer have to manually set timestamps, this gets handled for you in the DiscordGameInstance
class
There was also a issue with mismatched types for timestamps which caused the plugin to not work in packaged builds which has now been fixed also.