Skip to main content
Version: 5.11.2

Contributing Guild Goods

1. Write a method for contributing guild goods

Add content to the ContributeGoods method in BackendGuild.cs written in Pre-arrangements.

BackendGuild.cs

Before editing

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

After editing

    public void ContributeGoods() {
var bro = Backend.Guild.ContributeGoodsV3(goodsType.goods1, 100);

if(bro.IsSuccess() == false) {
Debug.LogError("An error occurred during guild contribution. : " + bro);
}

Debug.Log("Successfully contributed goods to the guild. : " + bro);
}

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.

At this time, the user to log in must belong to the guild.(The guild master from the call in Steps 2 and 4 or the guild member who sent the join request in Step 3)

BackendManager.cs

Before editing

    async void Test() {
await Task.Run(() => {
BackendLogin.Instance.CustomLogin("user1", "1234"); // Must be logged in as the user who created the guild in Step 3.

BackendGuild.Instance.AcceptGuildJoinRequest(0); // From users who sent join requests, accepts the one who sent the most recent request.

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

After editing

    async void Test() {
await Task.Run(() => {
// Must be logged in as the user who created the guild in Step 2 or the user who sent the join request in Step 3.
BackendLogin.Instance.CustomLogin("user1", "1234");

BackendGuild.Instance.ContributeGoods(); // Guild goods contribution(addition) 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 'Successfully contributed goods to the guild. : 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 ContributeGoodsV3 error case.

5. Check in the console

Go to BACKND Console and under BACKND Base > Guild Management click the Edit Goods button to the right of the created guild to see if the goods value has increased.