Loading 3D Avatars [Deprecated]
Code sample that demonstrates how to load an avatar at runtime.
These examples have been tested in Unity 2019LTS and newer versions.
Loading one 3D avatar at runtime
The RuntimeExample.cs
script demonstrates how to load one avatar at runtime.
Scene and Code
Assets/Plugins/Ready Player Me/Examples/Runtime Example/Runtime Example
Open and play the Runtime Example/RuntimeExample Scene. The example loads an avatar (and includes a Debug Log panel described below).
Open the RuntimeExample.cs script, which loads the avatar as follows.
Creates an instance of AvatarLoader:
var avatarLoader = new AvatarLoader();
Defines the
OnCompleted()
callback for theAvatarLoader
; this is called when loading has successfully completed.Adds an Avatar Configuration to the
AvatarLoader
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/Plugins/Ready Player Me/Examples/Runtime Example/Runtime Example Multiple
Open and play the Runtime Example/RuntimeExampleMultiple Scene. The example loads several avatars (and includes a Debug Log panel described below).
Open the Open the RuntimeExampleMultiple.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/Ready Player Me/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 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 troubleshooting avatar loading issues on device. Include the information contained in the log output with any support queries that you submit via our Technical Support channels.
Last updated