開發(fā)環(huán)境
- Unity 2018.2.13f
- Android Studio 3.2.1
- Android 8.1(API Level 27)
- SDK Build-Tools 28.0.3
- JRE 1.8.0_152
- GooglePlayGamesPlugin-0.9.51
接入
參考官方文檔 https://github.com/playgameservices/play-games-plugin-for-unity
注意
- GooglePlayGamesPlugin-0.9.51在Unity 2018.2版本中打包出來的安卓包是會(huì)閃退的,需要打開項(xiàng)目目錄下的template-AndroidManifest.txt散吵,將 "\ APP_ID" 更改成 "\u003__APP_ID__"律杠,然后執(zhí)行Window/Google Play Services/Setup
- 如果接入后不閃退但是Google Play Game登陸不成功,可能是因?yàn)椋?/li>
1)沒有完成OAuth認(rèn)證設(shè)置:
1.Google Play Console -> Select your app -> Release Management -> App signing -> "Upload certificate" copy SHA-1 (dont copy word 'SHA1:')
2. open https://console.developers.google.com/ , select your project -> credentials -> OAuth 2.0 client IDs -> Edit OAuth client -> Signing-certificate fingerprint -> replace the old SHA1 with copied SHA1 ->save.
3. open you game, you should get sign in -> email selection -> select testers email. Google Play Games Services should work fine now."
2).沒有設(shè)置測(cè)試賬號(hào)
11540716964_.pic_hd.jpg
參考:
https://answers.unity.com/questions/1357666/google-play-games-services-authentication-fails.html
https://github.com/playgameservices/play-games-plugin-for-unity/issues/2013