Achievements
Read more about the Achievements system in Hiro here.
Initializing the achievements system #
The achievements system relies on the Nakama System and an ILogger, both must be passed in as dependencies via the constructor.
| |
Subscribing to changes in the achievements system #
You can listen for changes in the achievements system so that you can respond appropriately, such as updating the UI, by implementing the IObserver pattern, or use the SystemObserver<T> type which handles it for you.
| |
Refreshing the achievements system #
To ensure the achievements system has the latest information from Nakama you can refresh it.
| |
Listing achievements #
You can list all achievements for the user.
| |
You can also list all repeatable achievements for the user.
| |
As well as list achievements by category for the user.
| |
Listing active achievements #
Filter achievements to show only those currently in an active time window using the IsActive field.
| |
To filter by category at the same time, pass the category name to GetAchievements.
| |
Note:
IsActivereflects whether the achievement is within its configured time window (start/end times, reset period, duration). It’s separate fromGetAvailableAchievements, which filters by precondition completion.
Listing available achievements by category #
Similarly to above, you can list achievements by category for the user, including only achievements the user is currently able to complete.
| |
Updating achievement progress #
You can update the user’s progress for achievements, passing in the each individual achievement’s progress.
| |
Alternatively, you can update multiple achievements by the same amount using this function overload.
| |
Claiming achievement rewards #
You can claim rewards for an achievement. You can also specify whether you would like to claim any available total rewards (e.g. if the user has completed all sub-achievements) If you are granting rewards to the player from completing an achievement, you should refresh the EconomySystem here to get the updated state.
| |
