Initialization

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.

  1. A. You need to inherit your GameInstance class from DiscordGameInstance:

image

  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:

image

image

image

I called my instance I_GameInstance (but just set it to whatever yours is called):

image

  1. Now that we are inheriting from DiscordGameInstance, we can set out App IDs. Simpily override event init and call SetAppIDs while passing your IDs into the params:

Note : AppID IS REQUIRED, Steam is OPTIONAL

image

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:

image

Set Discord Presence

Finally, once we have set our basic/all presence we can send it to the discord API using SetDiscordPresence:

image

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:

image