Git Product home page Git Product logo

unitygpgplugin's Introduction

UnityGPGPlugin

Unity3D Google Play Game Services Plugin

Copyright (C) 2011 Nerdiacs Pte Limited http://www.Nerdiacs.com

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Features

  • Support iOS and Android
  • Integrates with Unity's Social API
  • Works with the official Facebook SDK
  • Google Cloud Save
  • Leaderboards
  • Achievements
  • Signin

Usage for iOS

  • Read the iOS SDK docs to understand how all fits in. https://developers.google.com/games/services/ios/quickstart
  • On first usage, run bootstrap.sh to download the necessary SDKs. If newer SDKs are available than the one in bootstrap then download those and rename paths in Assets/Editor/googleplay_xcode.py.
  • Setup GooglePlayAppID and bundleId of your app/game in googleplay_xcode.
  • To test the sample App, in GCGui.cs file setup clientId from googleplay and rest of leaderboardip.
  • Run and build app on ipad. click on Init GPG before doing anything else. Try silentSignin and if it fails it will display SignIn button. Use that to do proper auto with switching.

Trouble Shooting

Signin doesn't work

The plugin expects google chrome in application:openUrl part. Change code there to allow any type of browser. Make sure bundled, gpgappid etc are all setup properly in both project and google dev console web guy.

Xcode Project Corrupted

There is PostBuildProcess script that adds frameworks and configures the overall project. Try removing that and add frameworks/bundles yourself using googleplay docs Use the quickstart guide link https://developers.google.com/games/services/ios/quickstart for more information

Conflicts with other plugins

  • If there is another PostBuildProcess from another plugin (facebook etc) then chain script from this one so that it runs as well.
  • The postbuildprocess patches AppController.m file by adding handler for google signin
(BOOL)application:(UIApplication *)application
             openURL:(NSURL *)url
   sourceApplication:(NSString *)sourceApplication
          annotation:(id)annotation 

This might conflict with facebook and you would need to remove the patch from PostBuildProcess and add this code manually each time project is generated. You coud also make a combined patch for google and other plugins.

Usage for Android

Import the package

Open NerdGPG.cs and specify the appID of your game (you get this online on the google play games console).

In the editor, you should see a menu at the top called "Nerdiacs". Press Nerdiacs->UpdateGPGFiles.

If console doesnt report any errors, it means your game is perfectly setup . enjoy :).

Troubleshooting

  • Recheck you followed the instructions correctly

  • Check if AndroidManifest.xml has following entries inside application tag

<meta-data ns0:name="com.google.android.gms.games.APP_ID" ns0:value="@string/app_id" />
<meta-data ns0:name="com.google.android.gms.appstate.APP_ID" ns0:value="@string/app_id" />
<activity ns0:label="@string/app_name" ns0:name="com.nerdiacs.nerdgpgplugin.DummyActivity" /> 
  • Check if plugins/android/res/nerdiacs.xml has correct googleplay appid with following tag in resources
<string name="app_id">YOURAPP_ID</string>

Known Issues

  • Conflict resolution for both iOS and Android is very basic. It automatically selects localData as resolvedData and overrides whatever is received from cloud. Best way is to always load data at start of app before trying to store. This would sync the data properly.
  • 512k of mem is always allocated for clouddata in Mono (iOS) and Java (Android). It will be changed once I figure out a better way to pass around byte arrays in java.

TODO

  • Add support for multiplayer matchmaking
  • Add support for sharing on google+

unitygpgplugin's People

Contributors

faizann avatar umarniz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unitygpgplugin's Issues

Initial error

I downloaded and imported the package, then filled in the App ID. With just that I am getting an error that "Default parameter specifiers are not permitted" on line 190.

The line is:
public bool loadAchievements(Action cb, bool bForceReload=false) {

Android Sign-in Crash

Steps to reproduce:

  1. Import GPGPlugin.unitypackage into Unity.
  2. Copy your application's AppId into NerdGPG.cs and click on Nerdiacs/UpdateGPGFiles.
  3. Attach the GPGGui.cs on a gameObject on scene, hit save then "Build and Run" for Android platform.
  4. After the game runs, click on "SignIn".
  5. Game will instantly close with the following logs:
D/NerdUnityPlayerActivity(12833): !! NerdUnityPlayerActivity:: onCreate called!
D/NerdGPG(12833): ParentActivity name is com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity
D/NerdGPG(12833): ParentActivity name is com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity
D/NerdGPG(12833): Connecting GamesClient.
D/NerdGPG(12833): onConnectionFailed: result 4
D/NerdGPG(12833): resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{42d4f940: android.os.BinderProxy@42d4f8e0}}
D/NerdGPG(12833): result has resolution. Starting it.
D/NerdGPG(12833): Resolving intent with activity com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity@42b32ca8
D/NerdGPG(12833): onActivityResult, req 9001 response 10004
D/NerdGPG(12833): responseCode != RESULT_OK, so not reconnecting.
D/NerdGPG(12833): giveUp: giving up on connection. Status code: 4
D/NerdUnityPlayerActivity(12833): RequestCode: 9002

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.1.5f1
Device model : samsung SAMSUNG-SGH-I747
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9002, result=0, data=null} to activity {com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3205)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3248)
at android.app.ActivityThread.access$1200(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4950)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity.onActivityResult(NerdUnityPlayerActivity.java:30)
at android.app.Activity.dispatchActivityResult(Activity.java:5363)
at android.app.ActivityThread.deliverResults(ActivityThread1.java:3201)

latest google-play-services.jar

I have the latest google-play-sevices.jar in my project for AdMob but it does not work with UnityGPGPlugin... when i switch back the jars using the one from the GPG package GPG works and AdMob doesn't so I know it has to have something to do with that. Any chance I can get an update for the latest google-play-services.jar?

4.4 Google Play Services

This does not work with the latest Google Play Services. Could you please ensure its working with the latest Android OS 4.4. I have tested on a Nexus 4 and Nexus 10 and both crash when trying to use this.

iOS Build Issue

Hi,

I am unable to get the iOS XCode project to build. It is saying it cannot find the GooglePlus/GooglePlus.h file. I believe I have placed the Google Plus SDKs into the corretc place (root of the project, along aside the Assets folder).

Any help would be appreciated.

Adam

login faild

login failed due to google services there is any thing wrong with old or new library. could you send me older
compatible res(google services ).

java.lang.NoClassDefFoundError: com.google.android.gms.R$string

Hello, I seem to have some crashes while using your plugin. Mostly it works great! But on a select few devices I get this error.

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.3.4f1
Device model : alps 06v20_v89_gq3009fwvga_2g
Device fingerprint: unknown

Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$string
at com.google.android.gms.common.GooglePlayServicesUtil.b(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.a(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.getErrorDialog(Unknown Source)
at com.nerdiacs.nerdgpgplugin.NerdGPG$1.run(NerdGPG.java:149)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)

GPGtTest Scene Crashes Unity

I am using Unity 3.5.7 and I've imported your entire Unity package. I was simply trying to go to the test scene and hit play and it crashes Unity. Any cause or reasoning for this?

Also I am trying to implement your work just by scripts in my scenes and I have been able to login successfully, afterwards I clicked GPG_HasAuthoriser, but from this point on I'm lost, do you have any further documentation I could use?

Android without GooglePlayServices Crash

Android devices that dont have GooglePlayServices creates this issue

java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.2.2f1
Device model : samsung GT-P3100
Device fingerprint: samsung/espressorfxx/espressorf:4.0.4/IMM76D/P3100XWBLH3:user/release-keys

Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$string
at com.google.android.gms.common.GooglePlayServicesUtil.b(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.a(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.getErrorDialog(Unknown Source)
at com.nerdiacs.nerdgpgplugin.NerdGPG$1.run(NerdGPG.java:149)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)

iOS Sign In Issue

I get the game to open up the sign in screen, I hit accept for allowing it access to whatever, it sends me back into the game, but nothing changes. Clicking to sign in again brings up the same window that requires accepting. Your troubleshooting does mention a sign in problem that may be the same (it's very vague), but I can't figure out how to fix it from what was written. This is for iOS deployment, done from a Mac, if that makes a difference.

LoadScores method not implemented

Do you plan to implement this method or could you give me some advices so that I can so it myself (and of course do a pull request when it's done ;) )?

java.lang.Error: FATAL EXCEPTION [main]

On sign in it crashes and when i reopen the app it was already signed in then i click on leaderboardsUI or AchievementsUi it opens the UI fine but again on pressing back button it crashes with the same error which is as follows:

02-07 10:22:47.660: E/AndroidRuntime(31986): FATAL EXCEPTION: main
02-07 10:22:47.660: E/AndroidRuntime(31986): java.lang.Error: FATAL EXCEPTION [main]
02-07 10:22:47.660: E/AndroidRuntime(31986): Unity version : 4.2.1f4
02-07 10:22:47.660: E/AndroidRuntime(31986): Device model : samsung GT-I9300
02-07 10:22:47.660: E/AndroidRuntime(31986): Device fingerprint: samsung/m0xx/m0:4.1.2/JZO54K/I9300XXELLB:user/release-keys
02-07 10:22:47.660: E/AndroidRuntime(31986): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9002, result=0, data=null} to activity {com.pepperpk.skitrix/com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity}: java.lang.NullPointerException
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread.deliverResults(ActivityThread.java:3182)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3225)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread.access$1100(ActivityThread.java:140)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.os.Looper.loop(Looper.java:137)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread.main(ActivityThread.java:4898)
02-07 10:22:47.660: E/AndroidRuntime(31986): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 10:22:47.660: E/AndroidRuntime(31986): at java.lang.reflect.Method.invoke(Method.java:511)
02-07 10:22:47.660: E/AndroidRuntime(31986): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
02-07 10:22:47.660: E/AndroidRuntime(31986): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
02-07 10:22:47.660: E/AndroidRuntime(31986): at dalvik.system.NativeStart.main(Native Method)
02-07 10:22:47.660: E/AndroidRuntime(31986): Caused by: java.lang.NullPointerException
02-07 10:22:47.660: E/AndroidRuntime(31986): at com.nerdiacs.nerdgpgplugin.NerdUnityPlayerActivity.onActivityResult(NerdUnityPlayerActivity.java:30)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.Activity.dispatchActivityResult(Activity.java:5390)
02-07 10:22:47.660: E/AndroidRuntime(31986): at android.app.ActivityThread.deliverResults(ActivityThread.java:3178)
02-07 10:22:47.660: E/AndroidRuntime(31986): ... 11 more

please have a look and provide a solution for this issue.thanks!

Regards,
Muhammad Tahir Ashraf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.