I have it successfully generating my API, which is neat and super handy. However, I don’t entirely know how to use it. It’s not particularly self-explanatory, and here is the entirety of the generated README.md. I’d appreciate a bit more information about the intended usage!
AccelByte Unity Customization
Getting Started
Preparation
Download the whole repository.
Add com.accelbyte.sdk.custom dependency into Packages/manifest
I’ve attached an example from this release of the Extend Codegen CLI containing a “working” (relies on a reachable Guild service) example of how one would use the code-generated service package in Unity. (see the accelbyte-unity-sdk-template-example/MyAwesomeGame/Assets/Usage.cs file)
using AccelByte.Api;
using UnityEngine;
using AccelByte.Core;
using AccelByte.Models;
public class Usage : MonoBehaviour
{
[SerializeField] private string _username;
[SerializeField] private string _password;
private ApiClient _apiClient;
private void Start()
{
_apiClient = AccelByteSDK.GetClientRegistry().GetApi();
User user = _apiClient.GetUser();
user.LoginWithUsernameV3(_username, _password, LoginWithUsernameV3Callback);
}
private void LoginWithUsernameV3Callback(Result<TokenData, OAuthError> result)
{
if (result.IsError)
{
return;
}
Guild guild = _apiClient.GetApi<Guild, GuildApi>();
guild.GuildServiceGetGuildProgress("foo", GuildServiceGetGuildProgressCallback);
}
private void GuildServiceGetGuildProgressCallback(Result<AccelByteGuildGuildGetGuildProgressResponse> result)
{
Debug.Log("Success!");
}
}
In the example above it uses the old way to get the ApiClient it is now encouraged to use MultiRegistry.GetApiClient().
The main takeaway here is the taking a hold of the instance of the ApiClient to get an instance of the <insert custom service name here>Api class. Similarly from how you would normally use the Unity SDK. See this tutorial on how to implement a periodic leaderboard.