GS2-SDK for UE5 Blueprint Tutorial

implement GS2-SDK for UE5 Blueprint to create an account and login

The procedure is the same as in the general tutorial up to the halfway point.

GS2 setup

SDK setup

Create credentials (API keys)

Prepare resources for login process

Initialize client

img.png

Create a GS2::Core::Action::Initialize node and set clientId / clientSecret / region to connect to. Set clientId / clientSecret to the values you created in Create Credential (API Key).

OnSuccess is called if initialization succeeds, and OnError is called if it fails.

On success, a GS2 client object is returned in Client, and on failure, an error object with the reason for the failure is returned in Error.

Create GS2-Account client

img_1.png

Create a GS2::Account::Service node with the Client object obtained during initialization.

A service client for GS2-Account functionality is returned in Service.

Generate Namespace object

img_2.png

Create a GS2::Account::Namespace node specifying the GS2-Account service client. For Namespace Name, specify the namespace name created in Prepare resources required for login process.

A GS2-Account Namespace object is returned in Namespace.

Create a new anonymous account

img_3.png

Create a GS2::Account::Action::Create node with the Namespace object of GS2-Account.

OnSuccess is called if the account is successfully created, and OnError is called if it fails.

In case of success, the created account object is returned in Account, and in case of failure, an error object with the reason for the failure is returned in Error.

Retrieving values from an account object

img_4.png

Create a GS2::Account::Fetch::GetValueOfAccount node with an account object.

OnSuccess is called if the account value is successfully retrieved, and OnError is called if it fails.

On success, the value of the account object is returned in Value, and on failure, an error object with the reason for the failure is returned in Error. By expanding the structure, the issued user ID and password can be retrieved.

Login

img_5.png

Create a GS2::Core::Action::Login node to perform the login process.

The GS2::Core::Action::Login node needs to specify an Authenticator. For the Authenticator, we specify the Authenticator created in the GS2::Core::CreateGs2Authenticator node. UserId / Password is the user ID and password created earlier.

OnSuccess is called if the login succeeds, and OnError is called if it fails.

On success, an AccessToken object is returned in AccessToken, and on failure, an Error object is returned in Error, indicating the reason for the failure.

The access token is a parameter required for API calls that require login.

API calls that can be invoked after login

As an example of API calls that can be invoked after login, let’s try to get a list of transfer information.

img_6.png

Create your own account object in GS2::Account::Me using the access token object. Then create a GS2::Account::Fetch::ListOfTakeOver node using your account object to get a list of takeover information.

OnSuccess is called if the list of takeover information is successfully retrieved, and OnError is called if not.

In case of success, an array of transfer information is returned in Values, and in case of failure, an error object with the reason of failure is returned in Error.

Values is looped through in the For Each Loop node and the values are retrieved.