Skip to main content
Version: 5.15.0

Loading Rankings

1. Copy the ranking UUID from BACKND Console

Go to BACKND Console and copy the UUID of the ranking created in BACKND Base > Ranking Management.

2. Write a method for inserting game information

Add content to the RankGet method in BackendRank.cs written in Pre-arrangements.

At this time, paste the UUID of the ranking copied in No. 1 as the rankUUID of the RankGet method.

Example: "<copied UUID value>" -> "4088f640-693e-11ed-ad29-ad8f0c3d4c70"

BackendRank.cs

Before modification

public void RankGet()
{
// Add content of Step 3. Loading Rankings
}

After modification

public void RankGet()
{
string rankUUID = "<copied UUID value>"; // Example: "4088f640-693e-11ed-ad29-ad8f0c3d4c70"
var bro = Backend.URank.User.GetRankList(rankUUID);

if (bro.IsSuccess() == false)
{
Debug.LogError("An error occurred while looking up rankings. : " + bro);
return;
}

Debug.Log("Ranking lookup successful. : " + bro);

Debug.Log("Total number of users registered to the ranking : " + bro.GetFlattenJSON()["totalCount"].ToString());

foreach (LitJson.JsonData jsonData in bro.FlattenRows())
{
StringBuilder info = new StringBuilder();

info.AppendLine("Ranking : " + jsonData["rank"].ToString());
info.AppendLine("Nickname : " + jsonData["nickname"].ToString());
info.AppendLine("Score : " + jsonData["score"].ToString());
info.AppendLine("gamerInDate : " + jsonData["gamerInDate"].ToString());
info.AppendLine("Sort code : " + jsonData["index"].ToString());
info.AppendLine();
Debug.Log(info);
}
}

3. Add method call to BackendManager.cs

BackendManager, which is automatically called when the game is executed, must be used to call this method.
Add it so that the method may be called after BACKND initialization and BACKND login.

BackendManager.cs

Before modification (After Step 2. Ranking Registration)

void Test()
{
BackendLogin.Instance.CustomLogin("user1", "1234"); // BACKND login method

BackendRank.Instance.RankInsert(100); // [Addition] Ranking registration method

Debug.Log("Test complete.");
}

After modification

void Test()
{
BackendLogin.Instance.CustomLogin("user1", "1234"); // BACKND login method

BackendRank.Instance.RankGet(); // [Addition] Ranking loading method

Debug.Log("Test complete.");
}

4. Test in Unity

After editing the script, execute Unity debugging and check the console log of Unity.

The method has been successfully called when the log displays 'User information updated on the ranking'.
When errors, such as statusCode : 400, 404, and 409, occur instead of the above log being displayed, you can check which errors caused the failure in GetRankList error case.

Error case

An error occurred while looking up rankings. : statusCode : 404
errorCode : NotFoundException
message : rank not found, rank cannot be found

Change the copied UUID value in the first line of the method, string rankUUID = "Copied UUID value"; to the actual UUID of the ranking created in the console.