- Home /
Question by
internet8 · Dec 13, 2015 at 02:57 PM ·
androidgoogle play games
Google Play Game for Unity doesn't work
Hi!
I am trying to add Google Play Services for my android game, but i can't. I have installed all plugins and uploaded apk to Google Play.
Here is my code:
using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class GPG : MonoBehaviour {
void Start()
{
PlayGamesPlatform.Activate ();
}
public void Awake ()
{
Social.localUser.Authenticate ((bool success) =>
{
if (success) {
Debug.Log ("Login Sucess");
} else {
Application.Quit();
}
});
}
public void PostLeaderBoard ()
{
if (Social.localUser.authenticated)
{
Social.ReportScore (5000, "MyLeaderboardID", (bool success) =>
{
if (success) {
LeaderBoard ();
} else {
Application.Quit();
}
});
}
}
public void LeaderBoard ()
{
((PlayGamesPlatform) Social.Active).ShowLeaderboardUI("MyLeaderboardID");
}
}
If I run my game on phone, then sign in box does't appear and if I call PostLeaderBoard (), my game does't close.
Hope someone can help.
Comment
Your answer
Follow this Question
Related Questions
Google Play Services error 0 Answers
Where can I find the resource definition for google play games android configuration? 1 Answer
Unity Google Play Service Plugin Social.localUser.Authenticate(…) App Crash 1 Answer
Google play Games plug in: failed to find candidate artifact for play-services-base 0 Answers
Problem with Google Play Game Services: Invalid Classname 1 Answer