Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ShowleaderboardsUI();不起作用_Android_Unity3d_Google Play_Google Play Services_Google Play Games - Fatal编程技术网

Android ShowleaderboardsUI();不起作用

Android ShowleaderboardsUI();不起作用,android,unity3d,google-play,google-play-services,google-play-games,Android,Unity3d,Google Play,Google Play Services,Google Play Games,我一直在努力将我的应用程序与google play服务连接起来,我的用户在连接应用程序时遇到了一个问题,但在这之后,我制作了一个带有“ShowleaderboardsUI();”的按钮,单击后什么也没有发生。我已将电子邮件添加到测试组 using UnityEngine; using UnityEngine.UI; using GooglePlayGames; using UnityEngine.SocialPlatforms; public class AchievmentManager :

我一直在努力将我的应用程序与google play服务连接起来,我的用户在连接应用程序时遇到了一个问题,但在这之后,我制作了一个带有“ShowleaderboardsUI();”的按钮,单击后什么也没有发生。我已将电子邮件添加到测试组

using UnityEngine;
using UnityEngine.UI;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;

public class AchievmentManager : MonoBehaviour
{

    private bool IsConnectedToGoogleServices;

   void Start()
    {
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();
        IsConnectedToGoogleServices = false;
        ConnectToGoogleServices();
    }

 public bool ConnectToGoogleServices()
    {
        if (!IsConnectedToGoogleServices)
        {
            {
                Social.localUser.Authenticate((bool success) =>
                    {
                        IsConnectedToGoogleServices = success;
                    });
            }
        }
        return IsConnectedToGoogleServices;
    }

    public void ToLeaderboard()
    {
        if (Social.localUser.authenticated)
        {
            Social.ShowLeaderboardUI();
        }
        else
        {
            Debug.Log("Unable to connect google play services");
        }
    }
}

您应该尝试将此添加到android mainfest:

 <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

您可以在Assets/Plugins/Android/AndroidMainfest.xml中创建自定义mainfest