Unity SDK 4.0.0 Migration guide

For some time, we have been developing the Avatar Creator as a separate project due to its initial readiness level, which required its own versioning and release cycle. Now that the Avatar Creator has been launched, we are integrating it into the core. This consolidation will simplify its utilization for developers.

We also decided to remove the auto-replacement of the avatars in the scene, when the avatar with the same ID was already in the scene to give you more freedom in avatar management.

Update Guide

1. Migrate avatar creator

Follow these steps if you have been using Avatar Creator and its sample.

1. Backup

It is recommended that you back up your project before updating to the new Unity SDK if you are not using source control.

2. Remove avatar creator

Using the Unity package manager remove the avatar creator and delete the imported sample.

3. Update core to v4.0.0 or higher

To update the core, navigate to the Ready Player Menu and select the ‘Check for Updates’ option. A confirmation prompt will appear to verify the update.

4. Import AvatarCreatorSamples

Once the core has been imported, you can proceed to import the ‘AvatarCreatorSamples’ from the samples in package manager.

5. Run the AvatarCreatorSample scene

This requires the configuration of the App ID in settings. You can obtain the App ID from your studio account.

2. Update Avatar Auto-Replacement

In 4.0 the AvatarProcessor no longer automatically finds and removes avatars with a particular ID. This was done as both an optimization but also to make our system more flexible. Now developers can handle avatar loading and removal however they like.

If your project uses AvatarProcessor or AvatarObjectLoader classes in your implementation you will need to make sure, that the avatar is cleared after loading. In previous versions, the following code would automatically remove the previous avatar GameObject, if it existed in the scene:

private void LoadAvatar(string url)
{
    var loader = new AvatarObjectLoader();
    loader.LoadAvatar(url);
}

The simplest way to add this feature back is by adding a similar functionality to the AvatarObjectLoader.OnCompleted method. For example

private void LoadAvatar(string url)
{
    var loader = new AvatarObjectLoader();

    loader.OnCompleted += (sender, args) =>
    {
        var oldInstance = GameObject.Find(args.Avatar.name);
        if (oldInstance != null) DestroyImmediate(oldInstance);
    };
    loader.LoadAvatar(url);
}

Last updated