IncrementAchievement

Description

Submit an incremental achievement.

Declaration

  public static void IncrementAchievement(AchievementNames achievementName, int steps, UnityAction<bool, GameServicesError> submitComplete = null)

Parameters

NameDescription

achievementName

AchievementNames is an enum auto-generated when you use the SettingsWindow to set up the plugin.

It contains all your achievements so it is easy for you to call it from your code

steps

How many units to be incremented

submitComplete

Callback called after submit process ends. bool true -> achievement submitted successfully bool false -> failed -> you get a GameServicesError

Example

using Gley.GameServices;
public class Test : MonoBehaviour
{
    public void SubmitIncrementalAchievement()
    {
        Gley.GameServices.API.IncrementAchievement(AchievementNames.LowJumper,5, SubmitComplete);
    }
    private void SubmitComplete(bool success, GameServicesError message)
    {
        if (success)
        {
            //achievement increment was submitted
        }
        else
        {
            //an error occurred
            Debug.LogError("Achievement failed to submit: " + message);
        }
    }
}

Last updated