Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by martrik · Aug 23, 2012 at 10:50 AM · ios3dgamecenter

Implementing Game Center

I'm developing a mobile game in Unity and would like to implement Game Center to have Leader Boards and Achievements. At the end I leave the code. So far I've managed to authenticate the user, but when I want to add points to the leaderboard it bugs: "Leader Board not found". I have also tried to show the Board with ShowLeaderBoardUi but it says: "ShowLeaderboardUI not implemented". Thank's for your help!

 #pragma strict
  
 var points : float = 3000;
 function Start () {
  
 Social.localUser.Authenticate (function (success) {
         if (success) {
             Debug.Log ("Authentication successful");
             var userInfo : String = "Username: " + Social.localUser.userName + 
                 "\nUser ID: " + Social.localUser.id + 
                 "\nIsUnderage: " + Social.localUser.underage;
             Debug.Log (userInfo);   
  
         }
         else
             Debug.Log ("Authentication failed");
     });
     
  
   
   Social.ReportScore (points, "europe.footsteps", callback) ;
   
   Social.ShowLeaderboardUI ();
   
   }
  
 function Update () {
  
 }
  
 function callback (){
  
 Debug.Log("Callback");
  
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Aug 23, 2012 at 11:57 AM 0
Share

i think prime31 make a plugin, just use that and save weeks

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by AlucardJay · Aug 23, 2012 at 04:15 PM

http://docs.unity3d.com/Documentation/ScriptReference/GameCenterPlatform.html

I have found and used a class that is easy to call and start referencing to and from GameCenter with. Just follow the guide, read the Unity Script Reference link on the 'site, and grab the singleton script =]

http://www.crywolfstudios.net/medieval-zombies-blog/2012/5/9/how-to-add-game-center-in-unity3d.html

This uses the information in the API as Mander has given you the link for in his answer.

Also as Fattie stated, check out Prime31, regarding their GameCenter Plugin and StoreKit (In App Purchasing) : http://prime31.com/unity/

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image martrik · Aug 23, 2012 at 05:30 PM 0
Share

But can you report a score from this Game Center Singleton? I don't see anithing from that in the code :(

avatar image AlucardJay · Aug 23, 2012 at 07:05 PM 0
Share

For this I added a method to the end of that script. Basically a direct copy of Social.ReportScore (make public void) : http://docs.unity3d.com/Documentation/ScriptReference/Social.ReportScore.html?from=ISocialPlatform

http://docs.unity3d.com/Documentation/ScriptReference/GameCenterPlatform.html

avatar image martrik · Aug 24, 2012 at 02:13 PM 0
Share

O$$anonymous$$! perfecte. But do you know if i can request to this singleton from a javascript, or is necessary to be a c file as the main singleton?

avatar image AlucardJay · Aug 24, 2012 at 04:21 PM 0
Share

I used it with C#, but if you look at this (point 3.) :

http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html

All scripts that are compiled in this step have access to all scripts in the first group ("Standard Assets", "Pro Standard Assets" or "Plugins"). This allows you to let different scripting languages interoperate. For example, if you want to create a Javascript that uses a C# script: place the C# script in the "Standard Assets" folder and the Javascript outside of the "Standard Assets" folder. The Javascript can now reference the C# script directly.

you can use the singleton and call it with JS. As calling the leaderboard and achievements start apple's interface, there is no problem with needing to read information from the C# script. Just put it in Standard Assets or Plugins folder. I used this a while ago, and since then havn't done any dev projects. If you are unsure and want some certainty, search for GameCenter plugins Unity or something similar, even search the asset store. There are a few other products out there that vary in price.

avatar image
0

Answer by Mander · Aug 23, 2012 at 02:54 PM

did u check the documentation? i think u can make it work with it. if not heres the link i personaly havent tried it but it looks promising

create ILeaderBoard

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Object generator? 1 Answer

2 Questions about iOS Pro 1 Answer

How to make an ingame weapon/ammo shop 0 Answers

Making A Tileset 1 Answer

How to open a door after a numerical password? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges