Skip to main content
Version: 6.0.0

Saving Game Logs

1. Write a game log insertion method

Add content to the GameLogInsert method in BackndGameLog.cs written in Pre-arrangements.

BackndGameLog.cs

Before editing

    public void GameLogInsert() {
// Adds logic of Step 2. Saving Game Logs
}

After editing

    public void GameLogInsert() {
Param param = new Param();

param.Add("clearStage", 1);
param.Add("currentMoney", 100000);

Debug.Log("Attempting to insert game log.");

var bro = Backnd.GameLog.CreateLog("ClearStage", param);

if(bro.IsSuccess() == false) {
Debug.LogError("An error occurred while inserting the game log. : " + bro);
return;
}

Debug.Log("Successfully inserted game log. : " + bro);
}

2. Add method call to BackndManager.cs

BackndManager, 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.

BackndManager.cs

Before editing

    async void Test() {
await Task.Run(() => {
BackndLogin.Instance.CustomSignIn("user1", "1234");

// Adds content of saving game logs

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

After editing

    async void Test() {
await Task.Run(() => {
BackndLogin.Instance.CustomSignIn("user1", "1234");

BackndGameLog.Instance.GameLogInsert(); // [Addition] Function for saving game logs

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

3. 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 'Successfully inserted the game log. : statusCode : 204'.
When errors, such as statusCode : 400, 404, and 409, occur instead of the above log, you can check which errors caused the failure in CreateLog error case.

4. Check in the console

When a log showing success appears in the game log, go to BACKND Console and under BACKND Base > Log Management, click Action Type and select the inserted action type.