Initialization 5.3
Version 5.3 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.
- A. You need to inherit your
GameInstance
class fromDiscordGameInstance
:
- B. If you're using unreals default
GameInstance
You'll need to create your own and inherit it fromDiscordGameInstance
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
Set Basic/All Presence
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:
Set Discord Presence
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: