Loading avatars
Load avatars manually or programmatically at runtime.
You can load avatars into your project manually using the Avatar Loader window, or programmatically using C#.

Obtain an Avatar URL

Whether you are loading through the Avatar Loader interface or programmatically, you need an Avatar URL (which is a URL to the .glb file for the avatar).
You also need a Unity project with the Avatar SDK package imported.

Load Avatars with the Avatar Loader Window

Avatar Loader Dialog in Unity
  1. 1.
    Launch the Avatar Loader Window by choosing Ready Player Me > Avatar Loader.
  2. 2.
    Find the Avatar Url or Short Code text box below the banner.
  3. 3.
    Paste your avatar URL (or shortcode).
  4. 4.
    Optionally, check Use Eye Animations.
  5. 5.
    Optionally, check Voice To Animation.
  6. 6.
    Click Load Avatar.
  7. 7.
    Your Avatar loads as Prefab into the current scene.
  8. 8.
    If necessary, adjust the Scene.
    • If the Avatar looks pixelated, slide Scale to 1.
    • Adjust the camera in the Scene, e.g. closer to the Avatar.
    • Change Scene Lighting (click the lightbulb icon).
    • Optionally, rotate the avatar for desired view angle.
  9. 9.
    Run your game. You should see your avatar performing an animation and an overlay displaying runtime data.

Load Avatars at Runtime

To load an avatar at runtime in C#, you can do the following.
  1. 1.
    Create an instance of the AvatarLoader. AvatarLoader avatarLoader = new AvatarLoader();
  2. 2.
    From the instance, call the LoadAvatar() method with an avatar URL. avatarLoader.LoadAvatar(AvatarURL);
For more information
  • refer to the skeleton code below for an example.
  • see the SDK API Reference for details on this class and its parameters.
Ready Player Me updates a user's avatar while preserving the original URL. If a user edits an avatar, or changes it from full-body to half-body, these changes are reflected on the same URL.

Skeleton code

You can also find the code below in the Assets\Plugins\Ready Player Me\Examples\Runtime Example\RuntimeExampleScene and script.
More details can be found in Examples.
using UnityEngine;
​
namespace ReadyPlayerMe
{
public class RuntimeTest : MonoBehaviour
{
[SerializeField]
private string avatarURL = "https://d1a370nemizbjq.cloudfront.net/209a1bc2-efed-46c5-9dfd-edc8a1d9cbe4.glb";
​
private void Start()
{
Debug.Log(quot;Started loading avatar");
AvatarLoader avatarLoader = new AvatarLoader();
avatarLoader.OnCompleted += AvatarLoadComplete;
avatarLoader.OnFailed += AvatarLoadFail;
avatarLoader.LoadAvatar(avatarURL);
}
​
private void AvatarLoadComplete(object sender, CompletionEventArgs args)
{
Debug.Log(quot;Avatar loaded");
}
private void AvatarLoadFail(object sender, FailureEventArgs args)
{
Debug.Log(quot;Avatar loading failed with error message: {args.Message}");
}
}
}