c# - Can't call GameCenter in my Unity game for iOS -


i'm trying integrate game center unity 5 project , facings troubles. seems authentification ok when game starts on ios device, notification appears, leaderboard button not work, nothing happens when tap gc button. assigned initiation of "showleaderboard()" gc button. please, take @ script use below. hope find resolution issue. thank in advance.

using unityengine; using unityengine.socialplatforms; using unityengine.socialplatforms.gamecenter; using system.collections;  public class gamecenter : monobehaviour {      public string leaderboardid = "mygameleaderboard";      void start () {         authenticatetogamecenter();     }      private bool isauthenticatedtogamecenter;     public static void  authenticatetogamecenter() {         #if unity_iphone         social.localuser.authenticate(success => {         if (success) {             debug.log("authentication successful");         } else {             debug.log("authentication failed");             }         });         #endif     }      public static void reportscore(long score, string leaderboardid) {         #if unity_iphone         debug.log("reporting score " + score + " on leaderboard " + leaderboardid);         social.reportscore(score, leaderboardid, success => {             if (success) {             debug.log("reported score successfully");             } else {                 debug.log("failed report score");                 }             });         #endif     }      //call show leaderboard     public static void showleaderboard() {         #if unity_iphone         social.showleaderboardui();         #endif     } } 

to show ios game centre leaderboard need use gamecenterplatform.

your code be:

void showleaderboard() {     #if unity_ios     gamecenterplatform.showleaderboardui(leaderboardid, unityengine.socialplatforms.timescope.alltime);     #endif } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -