You can use Online Services console commands to debug and test the Online Services plugin during gameplay.
Execute a Console Command
Online Services plugin console commands are executed from the Unreal Engine (UE) Console. The console can be accessed during Play-In-Editor (PIE) by pressing the tilde (~) key once (for no feedback) or twice (for verbose feedback). Use the following syntax to execute an Online Services console command:
OnlineServices Index=<NUM> <INTERFACE> <FUNCTION> [ARG1] [ARG2] ...
Parameters
The table below describes the parameters that make up an Online Services plugin console command:
Parameter |
Description |
Additional Information |
---|---|---|
|
Index number of the services you want to access. |
|
|
Interface whose functionality you want to access. |
|
|
Function within the specified interface you want to use. |
|
|
Arguments that compose the associated |
|
For examples of Online Services Console Commands, see the Console Command Examples section of this page.
Arguments
Online Services functions require you to pass a wide variety of parameter types. Since Online Services console commands provide a mechanism for running Online Services functions, different console command argument types have been implemented that correspond to these function parameter types. The Online Services console commands have a particular way of handling these types to help you pass complex C++ types through the Unreal Engine Console so they are recognized for use with these functions.
Special types include:
FAccountId
TSharedPtr
TOptional
TVariant
Objects
TArray
TMap
The table below provides more information about passing each of these special types along with some examples:
Type |
Information |
Examples |
---|---|---|
|
For an
|
|
|
Type in the parameter name as you normally would.
|
|
|
Use |
|
|
The syntax to pass a TVariant is
If you have a custom enum, you must use the macro |
Here are some examples of each type with a type and value pair:
|
|
Use brace-delimited syntax for objects with online metadata to declare all parameters flatly. Objects support internal objects and arrays. |
Here are some examples for objects:
|
|
Use bracket-delimited syntax for a |
Here are two examples of the same
|
|
Use brace-delimited syntax for a |
Here is an example of a
|
Console Command Examples
This section contains a few examples of console commands that you can use with the Online Services plugin enabled in your project. To use an online services console command, ensure that you have:
Enabled the Online Services plugin.
Configured the plugin for use in your project.
Obtained a reference to the services you wish to use in your project's code.
These console commands might not behave as they do below in your project if you have not retrieved a reference to the services you wish to use and configured each interface appropriately.
List Available Online Services
Command
OnlineServices List
This command lists the platform services that are available to access through the Online Services plugin.
Sample Output
0: Null
1: Epic
2: Steam
...
For this sample output, multiple online platform services are available and they can be referenced in Online Services console commands with the appropriate index number. For example, Null can be referenced with Index=0
, Epic can be referenced with Index=1
, Steam can be referenced with Index=2
, and so on.
Get Local Online User
Command
OnlineServices Index=0 Auth GetLocalOnlineUserByPlatformUserId 0
Sample Output
LogConsoleResponse: Display: GetLocalOnlineUserByPlatformUserId result: { AccountInfo: [{ AccountId: Null:1 (ID_STRING), PlatformUserId: 0, LoginStatus: LoggedIn, Attributes: {DisplayName:String:ID_STRING} }] }
Get Title Files
Command
OnlineServices Index=0 TitleFile GetEnumeratedFiles 0
Sample Output
LogConsoleResponse: Display: GetEnumeratedFiles result: { Filenames: [StatusFile] }
This output shows that there is a single Title File registered with the backend online services titled "StatusFile".
More Information
For more information about the topics discussed on this page, see the following pages: