Skip to main content
Version: SDK-5.11.2

Pre-arrangements

The following tasks must be completed in advance to implement ranking functions.

  1. Logic of completed login method
  2. A private table to store ranking data
  3. Rows with numeric type data
  4. Create rankings using the data of No. 1 in BACKND Console - Ranking Management
  5. Create a script exclusive to rankings

1. Logic of login method

All BACKND functions except login and sign-up require a login process to successfully call their methods.
If the login logic has not been implemented, please implement it according to the guidelines in 1. Implementing Login/Sign-up.

2. Create a private table to store the ranking data

Rankings operate based on the game information management data.
Therefore, rankings can only be created when the game information management contains numeric type data that can be set as key values.

If you have not completed BACKND Guidelines' 2. Implementing Game Information Functions > Step 1. Pre-arrangements, please complete creating the table by following Pre-arrangements.

The following table must be registered to proceed with the guidelines:

3. Create a row with numeric type data

In Game Information Management, create a(row) with numeric type data that will be used as scores in the rankings.

If you have not completed BACKND Guidelines' 2. Implementing Game Information Functions > Step 2. Implementing Game Information Insertion, please create the game information data through Game information insertion.

To proceed with the guidelines, you must register the following data.(At least one piece of numeric type data must exist, such as atk or level.)

4. Create rankings using game information management data

After the data is inserted properly into the game information, use the data to create a ranking.

1. Click "Create Ranking" in BACKND Console - Ranking Management

2. Enter ranking information

  • Type: user ranking
  • Ranking name: USER_RANK(name of your choice)
  • Initialization period: daily
  • Column reset when ranking ends: applied
  • Ranking field table: USER_DATA(table created in No. 2)
  • Ranking field column: level
  • Additional fields: none
  • Sorting: descending order
  • Ranking reward: none
  • Reward mail title:(disabled, enabled when ranking rewards are selected)

Confirm ranking creation

5. Create a script exclusive to rankings

Create a new script and change the name to BackendRank.
Then, open the BackendRank.cs script and change the content to the following:

BackendRank.cs

using System.Collections.Generic;
using System.Text;
using UnityEngine;

// Adds BACKND SDK namespace
using BackEnd;

public class BackendRank {

private static BackendRank _instance = null;

public static BackendRank Instance {
get {
if(_instance == null) {
_instance = new BackendRank();
}

return _instance;
}
}

public void RankInsert(int score) {
// Adds content of Step 2. Registering Rankings
}

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

BackendManager.cs

using UnityEngine;
using System.Threading.Tasks;

// Adds BACKND SDK namespace
using BackEnd;

public class BackendManager : MonoBehaviour {
void Start() {
var bro = Backend.Initialize(true); // Initialize BACKND

// Response value for BACKND initialization
if(bro.IsSuccess()) {
Debug.Log("Initialization successful : " + bro); // If successful, 'statusCode 204 Success'
} else {
Debug.LogError("Initialization failed : " + bro); // If failed, a 4xx statusCode error occurs
}

Test();
}

// A method that allows synchronous methods to be called from asynchronous methods(cannot be accessed by the Unity UI)
async void Test() {
await Task.Run(() => {
BackendLogin.Instance.CustomLogin("user1", "1234"); // BACKND login

// Adds a logic to implement ranking functions

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