VRoid SDK is a Unity Package
to link your app with VRoid Hub.

What can you do with VRoid SDK?

Link to VRoid Hub
using OAuth

Easily handle the usually cumbersome OAuth authentication procedure with just one function call.

It absorbs all differences in operation that depend on the execution environment (iOS, Android, Windows, macOS, Linux).

Easy access to
VRoid Hub's features

You can transparently handle VRoid Hub features via the functions provided by the SDK.

You can retrieve information such as a list of characters created by the user, or a list of characters that have been hearted (❤).

Handle VRoid Hub characters
as 3D models

Characters on VRoid Hub can be seamlessly used in Unity.

Acquired 3D model data is encrypted and cached for faster uploading.

1. Linking VRoid Hub and OAuth

The Authentication class is used for OAuth authentication and linkage with VRoid Hub.

You can obtain the Application UID and Secret for OAuth linkage from the application management page.

// Set the Application UID and Secret in advance
SDKConfiguration sdkConfiguration;

// Initialize the Authentication instance
Authentication.Instance.Init(sdkConfiguration.AuthenticateMetaData);

// Browser authentication instance
BrowserAuthorize browserAuthorize;

// Authentication with VRoid Hub
Authentication.Instance.AuthorizeWithExistAccount((bool isAuthSuccess) => {
if (!isAuthSuccess)
{
    // This is the first authentication for this application
    // Open the browser and get permission to link the application on the VRoid Hub website before authentication
    browserAuthorize = BrowserAuthorize.GenerateInstance(sdkConfiguration);
    browserAuthorize.OpenBrowser(AfterAuthentication);
}
else
{
    AfterAuthentication(true);
}
}, (Exception error) => {
    // A problem, e.g. network errors or timeouts (30 seconds) has occurred
});

// Manual input of authorization codes (e.g. Unity's button click events)
void OnPutClientToken(string clientToken) {
    browserAuthorize.RegisterCode(clientToken);
}

// Authentication complete
void AfterAuthentication(bool isSuccess)
{
    SceneManager.LoadScene("xxxxx");
}

2. Using VRoid Hub features

The HubApi class is used to access VRoid Hub's features.

The features that can be operated by the HubApi are available in the SDK specifications.

// Retrieve a list of the character models that you have created and registered on VRoid Hub
HubApi.GetAccountCharacterModels(
    count: 10, // Retrieve the first 10 items
    onSuccess: (List<CharacterModel> characterModels) => { /* When the character information is successfully retrieved */ },
    onError: (ApiErrorFormat errorFormat) => { /* When an error occurs (e.g. communication error) */ }
);

// Retrieve a list of hearted (❤) character models on VRoid Hub (Might not be available depending on the conditions of use)
HubApi.GetHearts(
    count: 10, // Retrieve the first 10 items
    onSuccess: (List<CharacterModel> characterModels) => { /* When the character information is successfully retrieved */ },
    onError: (ApiErrorFormat errorFormat) => { /* When an error occurs (e.g. communication error) */ }
);

3. Load VRoid Hub characters as a 3D models

The HubModelDeserializer class is used to load VRoid Hub characters as a 3D models.

HubModelDeserializer.Instance.LoadCharacterAsync(
    characterModel: characterModel, // Pass the CharacterModel
    onDownloadProgress: (float progress) => {
        // Notifies you of progress on a scale of 0.0 to 1.0 when a VRM file is not cached and needs to be downloaded
    },
    onLoadComplete: (GameObject characterObj) => {
        // A GameObject from a VRM file deserialized with UniVRM is returned
    },
    onError: (Exception error) => {
        // If an error occurs during execution, this function is called up
    }
)

Download

If you are interested in using the VRoid SDK, please submit an application from the following link.