book_4_sparkGenerated
code_blocksInput

Description

The GetAchievements method retrieves a collection of achievements associated with a package. This method is asynchronous and returns a ValueTask<AchievementCollection>, which represents the eventual completion of the operation and the resulting collection of achievements.

Usage

To use the GetAchievements method, you need to call it on an instance of the Package class. Since it is an asynchronous method, you should await its completion to get the result. Ensure that your calling method is also asynchronous or use a task-based approach to handle the asynchronous operation.

Example

// Example of using GetAchievements method
public async Task RetrieveAchievementsAsync()
{
    // Assume 'package' is an instance of Sandbox.Package
    var achievements = await package.GetAchievements();
    
    // Process the achievements
    foreach (var achievement in achievements)
    {
        Console.WriteLine($"Achievement: {achievement.Name}");
    }
}