Help with Game Center login.

I have an issue with Game Center login that I can’t find an answer to.
I have the Game Center authentication script in my main camera on the Menu scene. The problem is that when I open up the app on my iPhone connected to WiFi, the banner indicating that Game Center has logged in doesn’t show up, meaning that it’s not authenticating, thus I can not access to the leaderboards UI.

BUT when I turn the WiFi off and relaunch the app, the banner pops up and I can access the leaderboards UI (without the leaderboards showing because no internet is available).

So why is this happening? I have another project that uses the exact same script and it works perfect, so I’m guessing that the problem isn’t script-related.

Here is said script:

import UnityEngine.SocialPlatforms;

function Start () {
    Social.localUser.Authenticate (ProcessAuthentication);
}

function ProcessAuthentication (success: boolean) {
    if (success) {
        Debug.Log ("Authenticated");
    }
    else
        Debug.Log ("Failed to authenticate");
}

I’m running both projects on an iPhone 4 running iOS 6 and an iPod Touch 4 also on iOS 6, both with the same result.

Can somebody help me?
Thanks!

You may need to do the following:

  • Set Game Center to Sandbox mode. (See here)
  • Ensure you have logged into an account via game center in the app’s settings. (you can log in then log out again and test).

If authentication fails, it will present a log in UI.