Start with the sample

Avatar Creator sample Scene that showcases elements, scripts, and customization.

In this guide, you will explore and modify a sample Ready Player Me Avatar Creator to learn about required and optional elements and scripts, and how to customize them.

AvatarCreatorElements is an example Scene featuring core elements that are essential for setting up a Ready Player Me Avatar Creator within a game or application.

Install and run the sample

  1. Start a Unity project and verify that it meets the Prerequisites.

  2. Open Window -> Package Manager.

  3. Find the Ready Player Me Core package.

  4. Click the Samples tab, then scroll to AvatarCreaterSamples and click Import.

  1. Open the AvatarCreatorElements Scene located in Assets/Samples/Ready Player Me Core/VERSION_NUMBER/AvatarCreatorSamples/AvatarCreatorElements/Scenes.

  2. Press Play and explore the functionality of this minimalist Avatar Creator. (If your Scene looks clipped, make sure the Scale is set to 1 and you use a fixed aspect ratio, such as 16:9.)

Under the hood

Guided by the tips below, familiarize yourself with the elements that make up this example Avatar Creator.

Every Ready Player Me Avatar Creator must include the following elements and scripts in order to work.

  • An AvatarCreator GameObject with a script (SimpleAvatarCreator in this sample) that runs the show, as described below.

  • Elements where users can choose their avatar assets (AvaterCreatorUI > Elements in the sample). Each element includes a script that lists customizable UI elements.

  • Elements for user management (collected in the AvatarCreaterUI > UserManagement GameObject in the sample), including saving avatars and logging in to Ready Player Me accounts.

  • Buttons for login, saving, and creating new avatars (collected under the AvatarCreatorUI > Buttons GameObject in the sample).

  • Optional Buttons (also collected under the AvatarCreatorUI > Buttons GameObject in the sample) that allow users to switch between asset elements, for example, if your UI cannot accommodate showing all elements at the same time.

  • The TemplateSelectionElement, which lets users pick an appearance when they start designing a new avatar.

The SimpleAvatarCreator script

The sample Scene uses a single script SimpleAvatarCreator(you can find it in Assets > Samples > Ready Player Me Core > VERSION > AvatarCreatorSamples > AvatarCreatorElements > Scripts) attached to the AvatarCreator GameObject to seamlessly connect all the asset selection elements as well as manage user sessions and avatars.

The SimpleAvatarCreator script in turn uses the Ready Player Me Core package's AvatarManager script (Packages > Ready Player Me Core > Runtime > AvatarCreator > Scripts > Managers) to load, update, and create new avatars for users.

Public variables of the SimpleAvatarCreator script

  • On Avatar Created: An event triggered whenever an avatar is created or updated. In the sample, this triggers display of the TemplateSelectionElement.

  • Asset Selection Elements: A list of AssetSelectionElement objects. Each element displays assets of a certain type for the user to choose. Asset selection elements initialize upon the application's first run. The script listens for changes (e.g., selecting outfits) and updates the avatar accordingly.

  • Color Selection Elements: A list of color selection elements for setting asset or body color. Each ColorSelection item represents one color. Similar to the asset selection elements, color selection elements initialize upon the application's first run, the script listens for changes, and updates the avatar accordingly.

  • Animation Controller: Attached to the displayed avatar to control its animations. In this sample, the animator allows the user to rotate the avatar using mouse controls.

  • Loading Overlay: A simple overlay message indicating a loading state.

  • Body Type: Specifies the body type of the avatar so that matching assets can be fetched.

  • Create RPM Account: A GameObject referencing a Prefab for creating a Ready Player Me account. This is displayed if a user saves the avatar but is not logged in.

Elements for selecting assets and colors

An asset selection element displays all assets of an asset type and manages the callback for a selection. Similarly, a color selection element lets your users choose a color for an asset category, such as eyes or hairstyle, or the avatar's skin tone. (You choose which assets to include in the Asset Manager in Studio.)

You can find the Prefabs for these core elements inReady Packages/Ready Player Me Core/Runtime/AvatarCreator/Prefabs/Elements.

See Elements for details on these and additional elements, and on how to customize them.

User management

The sample's UI includes buttons for creating a new avatar, saving an avatar, getting a list of avatars, and login into a Ready Player Me account (SignUp Element, Login Element, Logout Element).

When a user opens the sample Avatar Creator for the first time, they are assigned an anonymous Ready Player Me account. This allows them to use the Ready Player Me ecosystem without having a registered account.

The sample does not include session management for the user. If you would like to save and store user sessions in your application, see User Management.

Because Ready Player Me is a free product, and we like to keep it that way, we ask you to always include the Ready Player Me Login and SignUp elements.

Next steps

Customize and expand the Avatar Creator Elements sample for your own application, or start from scratch to create your own Ready Player Me Avatar Creator.

  • See the Elements reference for details on all available Avatar Creator elements.

  • See User Management for guidance on handling sessions and Ready Player Me user accounts.

Last updated