Pre-arrangements
The following tasks must be completed in advance to implement game log functions.
- Logic of completed login method
- Create a script exclusive to game logs
1. Logic of completed 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 script exclusive to game logs
Create a new script and change the name to BackendGameLog .
Then, open the BackendGameLog .cs script and change the content according to the following:
using System.Collections.Generic;
using System.Text;
using UnityEngine;
// Add BACKND SDK namespace
using BackEnd;
public class BackendGameLog
{
private static BackendGameLog _instance = null;
public static BackendGameLog Instance
{
get
{
if (_instance == null)
{
_instance = new BackendGameLog();
}
return _instance;
}
}
public void GameLogInsert()
{
// Add logic of Step 2. Saving Game Logs
}
}
BackendManager.cs
using UnityEngine;
// Add BACKND SDK namespace
using BackEnd;
public class BackendManager : MonoBehaviour
{
void Start()
{
var bro = Backend.Initialize(); // 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)
void Test()
{
BackendLogin.Instance.CustomLogin("user1", "1234");
// Add content of saving game logs
Debug.Log("Test complete.");
}
}