AndroidアプリをUnityで作っています。
アプリを開いたときに自動的にGoogle Playと連携したかったのですが、開いてもアカウント認証のポップアップすら出ず、困ってます。何か考えられる原因・対処法はないでしょうか?
該当のソースコード
起動時のSceneのHierarchyに常設しているオブジェクトにアタッチしたスクリプトです。
C#
1using System.Collections; 2using System.Collections.Generic; 3using GooglePlayGames; 4using GooglePlayGames.BasicApi; 5using UnityEngine.SocialPlatforms; 6using UnityEngine; 7using UnityEngine.UI; 8 9public class GoogleServiceManager : MonoBehaviour 10{ 11 public Text debugLabel; 12 13 void Start () 14 { 15 if(! IsLogined()){ 16 PlayGamesClientConfiguration config = 17 new PlayGamesClientConfiguration.Builder().Build(); 18 19 PlayGamesPlatform.InitializeInstance(config); 20 PlayGamesPlatform.Activate(); 21//デバッグでここまでは確実に実行できていることを確認できました 22 23 SignIn(); 24 } 25 } 26 27 public void SignIn() { 28//テスト時にはこの下のif文・else文のどちらにもいかなかった 29 Social.localUser.Authenticate((bool success) => { 30 if(success){ 31 debugLabel.text = "Sign In Successed!!"; 32 } 33 else{ 34 debugLabel.text = "Sign In Failed"; 35 } 36 }); 37 } 38 39 public bool IsLogined() 40 { 41 return Social.localUser.authenticated; 42 }
試したこと
・Google Play Console側の一連の設定などを済ませ、β版として公開した後、ストアからダウンロードしました。もちろん、自分のアカウントをテスターに設定してあります。
・コード内にもコメントアウトしましたが、Social.localUser.Authenticate()
が実行されていないみたいです。理由がさっぱりわかりません...
あなたの回答
tips
プレビュー