- Home /
Game Center login issue
Hi Unity users,
I'm making an iOS game that uses the native Social API to log in to Game Center. It was working fine before, but for some reason, it will no longer log in. It almost looks like the sign in function isn't being called, because there wasn't any debug info in Xcode, not even an error. I tried everything; I did a clean build, updated Unity, checked my info on the Apple Dev site, got rid of duplicates. None of this worked. Is there anything else I could try? Any help would be much appreciated as I'm somewhat new to this Social API.
Code for my Game Center Manager
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms;
#if UNITY_IOS
using UnityEngine.SocialPlatforms.GameCenter;
#endif
public static class NewGameCenterManager {
public static bool IsGCUseLoggedIn {
get {
return Social.localUser.authenticated;
}
}
public static string GCUsername {
get {
return Social.Active.localUser.userName;
}
}
public static void SignIn(System.Action<bool> callback) {
Social.localUser.Authenticate(callback);
}
public static void UnlockAchievement(string id) {
if(IsGCUseLoggedIn) {
Social.ReportProgress(id, 100, null);
}
}
public static void IncrementAchievement(string id, double progress) {
if (IsGCUseLoggedIn)
{
Social.ReportProgress(id, progress, null);
}
}
public static void UpdateLeaderboard(string id, long score) {
if(IsGCUseLoggedIn) {
Social.ReportScore(score, id, null);
}
}
public static void ShowAchievements() {
if(IsGCUseLoggedIn) {
Social.ShowAchievementsUI();
}
}
public static float GetAchievementProgress(string id) {
return System.Convert.ToSingle(GameSettings.gameCenterAchievements[id].percentCompleted);
}
public static void ResetAchievements() {
if(IsGCUseLoggedIn) {
GameCenterPlatform.ResetAllAchievements(null);
}
}
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Did Social.LoadUsers() stop working? 3 Answers
IOS touch vs OnMouseDown & error messages 0 Answers
Can't call GameCenter in my Unity game for iOS 0 Answers
Distribute terrain in zones 3 Answers