Loading 3D Avatars

These examples have been tested in Unity 2020.3LTS and newer versions.

Loading one 3D avatar at runtime

The AvatarLoadingExample.cs script demonstrates how to load one avatar at runtime.

Scene and Code Assets/Samples/Enoch Avatar Loader/1.0.0/AvatarLoading/AvatarLoadingExample

  1. Open and play the AvatarLoadingExample Scene. The example loads an avatar (and includes a Debug Log panel described below).

  2. Open the RuntimeExample.cs script, which loads the avatar as follows.

    • Creates an instance of AvatarLoader: var avatarLoader = new AvatarObjectLoader();

    • Defines the OnCompleted() callback for the AvatarObjectLoader this is called when loading has successfully completed.

    • Adds an Avatar Configuration to the AvatarObjectLoader from Assets > Plugins > ReadyPlayerMe > Resources > Data > AvatarConfigurations.

    • Calls LoadAvatar() with the URL for the avatar to load. This operation will download, import, and load the avatar model into the Scene.

Loading multiple 3D avatars at runtime

This code sample demonstrates how to load multiple avatars at runtime.

Scene and Code Assets/Samples/Enoch Avatar Loader/1.0.0/MultipleAvatarLoading/MultipleAvatarLoadingExample

  1. Open and play the MultipleAvatarLoadingExample Scene. The example loads several avatars (and includes a Debug Log panel described below).

  2. Open the MultipleAvatarLoadingExample.cs script.

    • Notice that there is only one avatar URL.

    • Loading works in the same way as for one avatar and is repeated for every avatar to load.

    • The variations in the avatar are created by using a list of different configurations that are applied in OnCompleted() -> OnAvatarLoaded() after the avatar has been loaded.

Debug panel

Code Assets/Plugins/Enoch/Examples/Runtime Example/Runtime Debug Panel

The Debug Panel displays the avatar loader log output while the Scene is running in the Unity Editor or on a target device.

You can pause or hide the Debug Panel while playing, or select the Runtime Test game object and disable the DebugPanel(Script) component in the Inspector.

The Debug Panel is provided to assist in troubleshooting avatar loading issues on the device. Include the information contained in the log output with any support queries that you submit via our Technical Support channels.

Last updated