The ZegoAvatar SDK provides various makeup and accessories (such as cosmetic contact lenses, lipstick, gloss, beard, and clothes) and other aesthetic materials. Users can render and replace these materials on their virtual avatars in real time to build exclusive images that comply with their tastes.
Before you implement the
styles and materials feature, ensure that the following conditions are met:
You can create your virtual avatar and try the Styles and materials feature and other features to customize a personalized image. For more information about how to create a virtual avatar, see Automatic avatar generation.
Refer to the following procedures to implement the
styles and materials feature.
Adjustable dimensions include the eyebrow, tattoo, lip, beard, cosmetic contact lenses, glass, earphones, earrings, hair, and clothes.
(For more information about the supported dimensions and resource types, contact the ZEGOCLOUD team.)
If the ZegoCharacterHelper class is used, no APIs related to IZegoCharacter need to be called. Even though IZegoCharacter also has the setPackage API, do not call it directly. If you call the IZegoCharacter API skipping the ZegoCharacterHelper class, cache at the ZegoCharacterHelper layer will become untrusted.
After the basic avatar is created:
If you set the Packages import method to dynamic downloading, call the
setExtendPackagesPath API of ZegoCharacterHelper to set the Packages download directory to the downloadPath parameter before using the packages to facilitate resource indexing.
The downloadPath parameter needs to be specified to the folder of Packages, for example,
Call the setPackage API and introduce the packageID to adjust the appearance of the virtual avatar. The packageID parameter indicates the resource that needs to be set.
// Ensure that the external directory of Packages is set before the API is called. [_characterHelper setExtendPackagesPath:downloadPath] /** Call the Styles and materials API.*/ NSString *packageID = @"earphone7"; // earphone7 is the directory name of an earphone resource. Use the directory name under Packages provided by the ZegoAvatar SDK. [_characterHelper setPackage:packageID];