Search Unity

iOS Game Center Integration

Discussion in 'iOS and tvOS' started by realtimelover, Mar 31, 2015.

  1. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    Hello,
    I am a beginner of developing games with unity.
    I met a strange issue and can`t solve it myself.
    I am developing a game that includes the game center integration.
    I used simple unity codes as shown below.

    using UnityEngine.SocialPlatform;
    using UnityEngine.SocialPlatform.GameCenter;
    private string leaderboardID = "TestVersion"
    public void GameCenterButtonPressed(){
    Social.localUser.Authenticate (HandleAuthenticated);
    }
    privatevoidHandleAuthenticated(bool success){
    if (success) {
    Social.ReportScore(-5, leaderboardID, HandleScoreReported);
    }
    }

    I registered my test app on iTunes and set the leaderboard in Game Center tab.
    But nothing happens. I never saw Game Center Login window.
    I saw several tutorials for integration Game Center on iOS and followed them, but had no good result.
    And I wonder if it can be solved by using this simple codes.
    Please help me.
     
  2. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    936
  3. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    Thank you for your reply.
    And how can I set my ipad to Developer Mode?
    I registered my pad`s UDID on Apple Developer Console and used it on my provisioning file.
    Is this the cause of this issue?
    And I tested Game Center as my sandbox test account which is registered on itunes as a sandbox test accounts.
    I need your help once again.
     
  4. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Please ask in the correct forum section linked above.
     
  5. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
  6. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    Game Center Login was Success!
    I noticed that I didn`t set Game Center on my device to developer.
    I set it and login is success.
    But no socre was reported.
    I think it is the cause of incorrect setting on itunes or incorrect leaderboard name in my code.
    ScoreBoard.png
    This is my setting on iTunes.
    And I enabled the Game Center item on my app setting.
    I can`t know why the score is not reported.

    using UnityEngine.SocialPlatform;
    using UnityEngine.SocialPlatform.GameCenter;

    private string leaderboardID = "TestVersion"

    public void GameCenterButtonPressed(){
    Social.localUser.Authenticate (HandleAuthenticated);
    }
    privatevoidHandleAuthenticated(bool success){
    if (success) {
    Social.ReportScore(-5, "footgolfscoreboard", HandleScoreReported);
    }
    }
    I set code like that but I couldn`t see the posted score on Game Center.
    I tested it with my Sandbox test account which was registered.
    Please help me who knows this issue.
     
  7. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    You are reporting a negative score -5.

    What happens if you try a positive number like 5?
     
  8. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    I didn`t like that, but I think the result will be same as before.
    Because As you can see, I made another scoreboard and posted positive number.
    But nothing happened.
     
  9. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    I cannot find where you get "Standings" from. I get "Leaderboards". Is the page translated from another language? See attached.

    Another thought, did you try "parscore" as ID?
     

    Attached Files:

  10. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Ahh... I think you are using Leaderboard Sets which are different than regular Leaderboards.

    See this (scroll way down to the bottom):
    https://developer.apple.com/library.../GameKit_Guide/LeaderBoards/LeaderBoards.html

    And this:
    https://developer.apple.com/library...oards.html#//apple_ref/doc/uid/TP40013726-CH2

    I have never used Leaderboard Sets before, but you do not report score the same way you do with regular leaderboard. So my guess is that Unity's Social.ReportScore does not handle this.
     
  11. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    Thanks for your reply.
    Then how can I post my score on Game Center Leaderboard in unity?
    If you know, please let me know that.
     
  12. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Delete all the Leaderboard Sets and create individual Leaderboards only, not Sets.
     
  13. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    I will try and let me know the result as soon as possible.
    Regard.
     
  14. realtimelover

    realtimelover

    Joined:
    Oct 26, 2014
    Posts:
    7
    I tried to delete Leaderboard Sets, but the "Delete" button is disabled now.
    How can I delete it?
    And I think when I registered leaderboards at first, it required to set the Leaderboard Sets.
    How about your think?
     
  15. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Try clicking "Remove All Leaderboards in Leaderboard Sets". This will move them all back into individual leaderboards and not in sets anymore.

    You can then delete each leaderboard one by one except the last one (default). For this one you need to click on it, and on the next screen it will say DELETE in the top left corner.

    Then start again and add some new Leaderboards but do NOT make them Sets.