Skip to main content

Updating an avatar

Update an avatar​

Instead of creating a new avatar, you may want to edit one of your already existing ones. You can edit:

  • The name
  • The outfit
  • The head
csharp
async void UpdateAvatar()
{
// You need to get you avatar metadata. You can do so by ID
AvatarMetadata avatar = await session.GetAvatar(new Guid("YOUR_AVATAR_ID"));
// Then update the fields you wish, in this case we are going to update the outfit
// You can also update the name or head, if you wanted to
avatar.OutfitId = new Guid("YOUR_OUTFIT_ID");
// Send the request to update the avatar with the new fields
AvatarMetadata updatedAvatar = await session.UpdateAvatar(avatar);
if(updatedAvatar == null)
{
Debug.LogError("Error while updating the avatar");
return;
}
// Import your updated avatar
await AvatarImporter.ImportAvatarAsHumanoid(updatedAvatar, yourAnimationController);
// ...
}
csharp
async void UpdateAvatar()
{
// You need to get you avatar metadata. You can do so by ID
AvatarMetadata avatar = await session.GetAvatar(new Guid("YOUR_AVATAR_ID"));
// Then update the fields you wish, in this case we are going to update the outfit
// You can also update the name or head, if you wanted to
avatar.OutfitId = new Guid("YOUR_OUTFIT_ID");
// Send the request to update the avatar with the new fields
AvatarMetadata updatedAvatar = await session.UpdateAvatar(avatar);
if(updatedAvatar == null)
{
Debug.LogError("Error while updating the avatar");
return;
}
// Import your updated avatar
await AvatarImporter.ImportAvatarAsHumanoid(updatedAvatar, yourAnimationController);
// ...
}