Achievements Google Play.

Hello Everyone.

Now I have my project set up where there are two scripts, one handles the touch controls, score and submits it to the leader boards. It does all this perfectly. The other script is in charge of the achievements which does not work.

using UnityEngine;
using System.Collections;

public class achivement : MonoBehaviour {

	public int[] achive = new int[] {100, 1000, 9000, 15000, 25000};
	public int i = 0;
	public string[] achivements = {"CgkIw9GY-aYIEAIQAg"," CgkIw9GY-aYIEAIQAw","CgkIw9GY-aYIEAIQBA","CgkIw9GY-aYIEAIQBQ","CgkIw9GY-aYIEAIQBw" };


	Bloop bloop; 

	// Use this for initialization
	void Start () {

		GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");
		bloop = camera.GetComponent<Bloop>();

	}
	
	// Update is called once per frame
	void Update () {

		if (bloop.score >= achive*)* 
  •  {*
    

_ Debug.Log(achive );_
_ Social.ReportProgress(achivements*, 100.0f, (bool success) => {
if(success)
i++;
else*
* print (“Something went wrong”);
});*_

* }*

* }*
}
The first script calls for all the Google Play stuff. It calls
PlayGamesPlatform.Activate ();
Do I need to put that in the above script? I have tried but to no avail.

I had lots of trouble with this as well. Read the comments on line 249 of PlayGamesPlatform.cs. This could be your problem as the plugin does not exactly implement the Unity Social Platform interface as you expect.

I’m not saying this is the best way, but I ended up using the following to report progress

	(Social.Active as PlayGamesPlatform).IncrementAchievement(achievement.id, steps, success=>{

Also note you can’t report the same achievement progress more than once.

As a heads up, if you were like me and expecting to use the exact same code for achievements in iOS GameCenter and Google Play…well I was not able to. I implemented achievements in Game Center, Google Play and Amazon Game Circle and each had their own problems interfacing with the unity social platform. I ended up wrapping the plugins with my own interface.