Skip to main content
Version: 5.11.8

Pre-arrangements

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

  1. Logic of completed login method
  2. Create a script exclusive to guilds

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 guilds

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

BackendGuild.cs

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

// Adds BACKND SDK namespace
using BackEnd;

public class BackendGuild {
private static BackendGuild _instance = null;

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

return _instance;
}
}

public void CreateGuild(string guildName) {
// Step 2. Creating Guilds
}

public void RequestGuildJoin(string guildName) {
// Step 3. Finding Guilds and Sending Join Requests
}

public void AcceptGuildJoinRequest(int index) {
// Step 4. Accepting Guild Join Requests
}

public void ContributeGoods() {
// Step 5. Contributing Guild Goods
}
}

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"); // Logs in as user1

// Adds guild logic

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