Generate a didimo

The Unity SDK contains a module, Didimo.Networking, which integrates directly with the API.

This facilitates several things including creating and downloading didimos. It is meant to be used as a demo, and should not be deployed into a production environment as is, since it uses an API Key that will be shipped with the built application.

The NetworkDemo scene allows for immediate interaction with the API. A didimo can be created by performing the following steps:

  1. Open Assets/Didimo/Networking/Examples/Scenes/NetworkDemo
  2. Select the NetworkDemo game object
  3. Click the Create didimo And Import button
  4. A prompt will appear, to select an image. A frontal photo of a person should be selected, where the whole face is visible, and said person doesn't have any facial expression.
  5. Wait for completion. Didimos are generated in less than 2 minutes.
The NetworkDemo component.The NetworkDemo component.

The NetworkDemo component.

A progress bar will show up in the NetworkDemo component, informing you of the generation progress of your didimo. Once the didimo is created, it will be automatically downloaded and imported into the scene.

The NetworkDemo component has many buttons that implement calls to our API for several functionalities.

  1. Open Developer Portal Documentation - Opens the link to our developer portal documentation
  2. Create didimo And Import - Creates a didimo and imports it into the scene.
  3. Delete didimo - Delete a didimo with the given key. Fill that key at the Didimo Key field of this component. The List didimos call will list the keys of the didimos of your account.
  4. List didimos - List the first 20 didimos of your account. The IDs will be added to the Selected Didimo list.
  5. Import From Key - Import the didimo selected in the Selected Didimo list. To fill this list, click the List didimos button.
  6. Add Random Hair - Adds a randomly fitted hairstyle to your didimo.
  7. Change Hair Color - Selects the Hair prefab on the scene so you can change it's color and appearance.
  8. Remove Hair - Removes the current hairstyle from the didimo.

Integration with an arbitrary API

The API interaction provided by the SDK is meant to be used as a demo, and should not be deployed into a production environment. For production, an implementation of the IApi interface should be created. This implementation should then be registered in the Api class, anytime before any method of Api is called.

Didimo.Networking.API.SetImplementation(new CustomApiImplementation());

Where CustomApiImplementation is the new implementation of the IApi interface.

public class CustomApiImplementation : IApi
{
    public async Task<(bool success, string didimoKey)> CreateNewDidimo(string filePath)
    {
      // Implementation goes here
    }
    
    (...)
}

Did this page help you?