- Home /
Google Play Game Services plugin problem
I want to implement Google Play Game Services in my android game. I'm using this plugin: https://github.com/playgameservices/play-games-plugin-for-unity
I downloaded latest version (0.9.06) and imported to my unity project. I've done everything like in this video: https://www.youtube.com/watch?v=XmHXl-UFTqM I turn on the game and I log in to my play games account correctly, but when I want to post score, unlock achivement, open leaderboard screen or achivements screen, absolutely nothing is happen, I don't know why, do you think that is because I'm using Unity beta 4.6.0b20?
Here is my code:
using UnityEngine.UI;
using UnityEngine;
using System.Collections;
using UnityEngine.SocialPlatforms;
using GooglePlayGames;
public class MainMenu : MonoBehaviour {
void Awake () {
PlayGamesPlatform.Activate();
}
void Start () {
Social.Active.localUser.Authenticate((bool success) => {
// handle success or failure
});
}
public void HighScoresButtonClicked () {
Social.Active.ShowLeaderboardUI();
}
public void Unlock Achivement () {
Social.ReportProgress("achivementID", 100.0f, (bool success) => {
// handle success or failure
});
}
public void ExitClicked () {
Application.Quit();
}
}
are you testing this on a device? if so, can you please attach the logcat output from the device?
W/Unity (12589): *** [Play Games Plugin DLL] ERROR: Show$$anonymous$$erboardUI can only be called after authentication.
But I did authentication on start.
EDIT: I don't know how, but it works now, I do nothing and it works :D
I am also having this problem, I am using Unity 4.6 Beta 20, Google Play Services Rev. 20 and I am also using a first gen Nexus 7 tablet, with Google Play Games set to automatically the latest updates. The problem that I seem to get the most is when it says Show$$anonymous$$erboardUI not implemented. This is the only thing that I really need to get fixed before my game can be published.
how can i know whether user authenticated or not, am unable to find whether user is logged in or not. Social.Active.localUser.Authenticate((bool success) => { // handle success or failure });
I used above code for user authentication and also i activated googleplaygames in start method
Help me regarding this authentication issue
Answer by santino94 · Oct 13, 2014 at 04:12 PM
This is my LogCat:
I/Unity ( 4300): [Play Games Plugin DLL] GHM/GameHelperListener got onSignInSucceeded, origin 1000, notifying GHM.
I/Unity ( 4300): I/Unity ( 4300): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49) I/Unity ( 4300):
I/Unity ( 4300): [Play Games Plugin DLL] GHM got onSignInSucceeded, origin 1000, notifying AndroidClient. I/Unity ( 4300): I/Unity ( 4300): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49) I/Unity ( 4300):
I/Unity ( 4300): [Play Games Plugin DLL] AndroidClient got OnSignInSucceeded. I/Unity ( 4300):
I/Unity ( 4300): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49) I/Unity ( 4300): I/Unity ( 4300): [Play Games Plugin DLL] Attempting to retrieve player info. I/Unity ( 4300): I/Unity ( 4300): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 49) I/Unity ( 4300):
I/Unity ( 4300): AndroidJavaException: java.lang.NoSuchMethodError: no methodwith name='getClass' signature='()Ljava/lang/Object;' in class Lcom/google/android/gms/common/api/b; I/Unity ( 4300): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0
I/Unity ( 4300): at UnityEngine.AndroidJNISafe.GetMethodID (IntPtr obj, System.String name,System.String sig) [0x00000] in :0
I/Unity ( 4300): at UnityEngine._AndroidJNIHelper.GetMethodID (IntPtr jclass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0
I/Unity ( 4300): at UnityEngine.AndroidJNIHelper.GetMethodID (IntPtr javaClass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0
I/Unity ( 4300): at UnityEngine._AndroidJNIHelper.GetMethodID[AndroidJavaObject] (IntPtr jclass, System.String methodName, System.Object[] args, Boolean isStatic) [0x00000] in :0
I/Unity ( 4300): at UnityEngine.AndroidJNIHelper.GetMethodID[AndroidJavaObject] (IntPtr jclass, System.String methodName, System.Object[] arg
What device are you using? Can you verify what version of Google Play Services is installed there?
I'm using: http://phonepad.mediacomeurope.it/Prodotti/Scheda.aspx?XRC=$$anonymous$$-PPAS501 with Google Play Services 6.1.11
I'm using too: Unity 4.5.4f1 GPG 0.9.06
Answer by AlfonsoC · Nov 05, 2014 at 05:52 PM
Hi, i think the problem is in how you call the showLeaderBoard method, only use Social.ShowLeaderBoard() instead of Social.Active.ShowLeaderBoard() for me worked fine and in the github doc says this way too showing the leaderboard
good luck
Answer by TheOtherJoJo · Sep 01, 2015 at 08:48 PM
I had success only when I have created the app on the production tab. Don't publish it until you are ready to push it the store though, but it will still allow you to test achievements and such.
When i published to beta or alpha I never got it to authenticate.
Here is a youtube video of the whole process. https://www.youtube.com/watch?v=XmHXl-UFTqM
If you get those DEX errors just make sure you read the log in the console to find the offending file that keeps it from compiling. When you find the file(s), do a search in your project folder and delete the duplicates. You get these duplicates when you use plugins that uses the same .jar files.
Answer by wuym67123 · Feb 16, 2017 at 01:53 PM
You can Use Google Service Unity Plugin
Google Service Unity Plugin is a Unity Plugin For Google Service.Include Google Admob Unity,Firebase Analytic Unity,Google Game API Unity. Login,Achievement,Leaderboard,Event,Quest,Snapshot,RealTimePlayGame,TurnbasedPlayGame API are supported and easy to use with c# or js.
Unity Plugin Wiki and Documentation
Unity Admob API Unity Firebase Analytic API Unity Google Game API Unity Admob Tutorial Unity Firebase Analytic Tutorial Unity Play Game Service Tutorial Firebase Remote config and log Quick Start
Installation Google Play Game Service Unity Plugin
Open your project in the Unity editor. Navigate to Assets -> Import Package -> Custom Package. Select the google_service_unity_plugin.unitypackage file. Import all of the files for the plugins by selecting Import. Make sure to check for any conflicts with files.playgamedemo.cs and game.unity is demo file can be ignored. replace all "com.google.demo" with your app package id in AndroidManifest.xml replace app_id content with your google play game id,replace google_app_id content with your google firebase app id in ids.xml Show Admob Ads in Unity game
using admob; Admob.Instance().initAdmob("ca-app-pub-3940256099942544/2934735716", "ca-app-pub-3940256099942544/4411468910"); Admob.Instance().showBannerRelative(AdSize.Banner, AdPosition.BOTTOM_CENTER, 30, "defaultBanner"); just 2 line code,admob banner will been shown on screen.for more usage Unity Admob Tutorial
Analytic Unity game with firebase Analytic
using google.service.game; FirebaseAnalytic.Instance().logEvent("appstart", "{\"time\":\"112222\",\"name\":\"demouser\"}"); Log Event with Firebase Analytic.For more usage about Firebase Analytic Unity Unity Firebase Analytic Tutorial
Using Google Play Game Achievements and Leaderboards in Unity game
Login with google play service using google.service.game; GoogleGame.Instance().login (true, false); You can call google play game api after login success such as show Leaderboards with default UI GoogleGame.Instance().showLeaderboards(); Show Google play game Achievements with default UI GoogleGame.Instance().showAchievements(); 4.Fore more usage about google play game service in unity Unity Google Play Game Tutorial