Hello, I made a game for android and now I am trying to make it work with iOS. I have been following the documentation on how to use SocialPlatforms.GameCenter but Since i am fairly new at this I am getting stuck.
This is the Error I receive:
LeaderboardsController.cs(68,44): error CS1501: No overload for method
ShowLeaderboardUI' takes
1’ arguments
In my code I am passing ShowLeaderboardUI only one argument - a constant string which is my leaderboardID. (below is the entire class)
using UnityEngine;
using System.Collections;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
public class LeaderboardsController : MonoBehaviour
{
public static LeaderboardsController instance;
private const string LEADERBOARDS_SCORE = "MYIDFORLEADERBOARDHERE";
void Awake()
{
MakeSingleton();
}
void Start()
{
//PlayGamesPlatform.Activate();
}
void OnLevelWasLoaded()
{
ReportScore(GameController.instance.GetHighscore());
}
void MakeSingleton()
{
if(instance != null)
{
Destroy(gameObject);
}else
{
instance = this;
DontDestroyOnLoad(gameObject);
}
}
public void AuthenticateToGameCenter()
{
//you are logged in
#if UNITY_IPHONE
Social.localUser.Authenticate((bool success) => {
if(success)
{
Debug.Log("Success");
}
else
{
Debug.Log("Failed");
}
});
#endif
}
public void OpenLeaderboardsScore()
{
#if UNITY_IPHONE
if (Social.localUser.authenticated) {
GameCenterPlatform.ShowLeaderboardUI (LEADERBOARDS_SCORE);
} else
{
Debug.Log("something went wrong");
}
#endif
}
void ReportScore(int score)
{
#if UNITY_IPHONE
if (Social.localUser.authenticated)
{
Social.ReportScore(score, LEADERBOARDS_SCORE, (bool success) => { });
}
#endif
}
}
The Docs say to have a TimeScope. I am not really sure how to write one - is this required?
Please help, thank you very much in advance!