Skip to content

Avatar

Introduction

An Avatar is an unlockable and equippable reward given to players. It is similar to a profile picture and is intended to be shown next to a player's name on a Leaderboard.
It consists of an ID, Title, Source, and an Unlocked status. The Source field is where the identifier or file path of its asset is stored. If the source is a url, then you can use that url to download and display the player avatar. If it's the name of an asset in an asset database that's stored as an addressable, you can load that asset at runtime when you display a ui that requires avatars.

Avatars are contained within IAvatarCollections, which are used to separate avatars thematically and for easier management of a large amount of avatars.

IAvatarCollection

IAvatarCollection is a collection of Avatars. The IAvatarCollection is responsible for locking and unlocking individual Avatars for a player. Once an IAvatarCollection is unlocked and obtained by the player, the individual Avatars within the collection can then be unlocked through various reward sources, or they can be set to be unlocked by default when the IAvatarCollection is unlocked. The IAvatarCollection also has additional functionality to check if an IAvatarCollection contains a specific Avatar, or to return a list of all unlocked Avatars.

IAvatarService

The Avatar Service is used to access IAvatarCollections. The IAvatarService can be used to get all IAvatarCollections, all unlocked Collections, or check the unlock status of individual Avatars. Unlocking individual Avatars should generally be done through the IAvatarService, as that will also unlock the containing IAvatarCollection if that has not been already done.