Hi, I have a problem with the Leaderboard.
It turns out that in the first scene of my game I made the login, then in another scene the game is developed, if the level is passed, the score is sent to the leaderboard, but I get the error "Failed to register the score".
using the same demo script does not work for me, but if I open the demo scene, the score is sent without problems.
What can I do wrong?
Greeting form Chile!!!
something happens ... if I call the function "LeaderboardsPost ()" from code, it does not register the score, but if I apply it to a button if it does.
What would be the procedure so that the score is registered without problem in the "Start"?
What is exactly the code you're trying to run? You're talking about "LeaderboardsPost()" but if you mean the function in CombuDemo.cs then note that it's sending the score typed in the associated Text input (that is empty by default), unless you have modified it.
FRANCESCO CROCETTI @ SKARED CREATIONS
This code:
public Text leaderboardScore;
int score;
// in "start"
// int leaderboardScore.text = score.ToString();
public void LeaderboardsPost()
{
if (string.IsNullOrEmpty(leaderboardScore))
{
leaderboardError= "Enter a score";
return;
}
leaderboardError.text = "cargando...";
CombuManager.platform.ReportScore(leaderboardScore, leaderboardId, (bool success) => {
if (success)
{
LeaderboardsScores();
leaderboardScore= "";
leaderboardError.text = "puntage registrado";
}
else
{
LeaderboardsScores();
leaderboardError.text = "Failed to register the score";
}
});
}
Your code is wrong because in your code leaderboardScore is a Text, so it should pass leaderboardScore.text to ReportScore and also in the if statement.
I noticed that you were trying to set leaderboardScore.text to score.ToString in the comment, but you cannot set it in that point of class, instead you should move that line inside the method LeaderboardsPost right before "if (string.IsNullOrEmpty(leaderboardScore.text))".
FRANCESCO CROCETTI @ SKARED CREATIONS
It worked!!
Thank you so much!!!!
Greetings from Chile