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 IDAvatarMetadata 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 toavatar.OutfitId = new Guid("YOUR_OUTFIT_ID");// Send the request to update the avatar with the new fieldsAvatarMetadata updatedAvatar = await session.UpdateAvatar(avatar);if(updatedAvatar == null){Debug.LogError("Error while updating the avatar");return;}// Import your updated avatarawait AvatarImporter.ImportAvatarAsHumanoid(updatedAvatar, yourAnimationController);// ...}
csharp
async void UpdateAvatar(){// You need to get you avatar metadata. You can do so by IDAvatarMetadata 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 toavatar.OutfitId = new Guid("YOUR_OUTFIT_ID");// Send the request to update the avatar with the new fieldsAvatarMetadata updatedAvatar = await session.UpdateAvatar(avatar);if(updatedAvatar == null){Debug.LogError("Error while updating the avatar");return;}// Import your updated avatarawait AvatarImporter.ImportAvatarAsHumanoid(updatedAvatar, yourAnimationController);// ...}