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 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 didimos of your account. We will print in the console the key and generation complete percentage of each didimo.
  5. Add Random Deformable Asset - Adds a random hairstyle to your didimo. Note that for the hairstyle to fit the didimo, you will need to deform it. You can do this using the Deform Hair button.
  6. Deform Asset - Deforms the current hairstyle so it fits the didimo's head.
  7. Set Hair Color - Sets the hair colour to the colour specified in the Hair Color field of this component.
  8. Remove Deformable - 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?