Unity项目中的GameCenter

时间:2015-05-01 14:22:20

标签: c# ios unity3d game-center

我试图在我的团结项目中实施GameCenter。到目前为止,我已经在iTunes中创建了一个应用程序连接并设置了游戏中心和排行榜。

以下功能是在UI按钮内统一调用。

public void ShowLeaderBoardGameCenter()
{
    Social.Active.ReportScore (1, "55379413", success => {
        Debug.Log(success ? "Reported score successfully" : "Failed to report score");
    });
    Social.Active.ShowLeaderboardUI ();

}

它可以找到显示排行榜,但得分并没有显示。

我还为目前使用的gamecenter创建了一个沙箱帐户。

在我的团结项目中它说"未找到排行榜" ??? - 希望你们能提供帮助。

1 个答案:

答案 0 :(得分:0)

试试这个,

    if (Social.localUser.authenticated) 
    {
        #if UNITY_ANDROID
        {
            ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI (leaderboard); // Show current (Active) leaderboard
        }
        #elif UNITY_IOS
        {
            GameCenterPlatform.ShowLeaderboardUI ("BallzBrickSmasher_Leaderboard", TimeScope.AllTime);
        }
        #endif
        }