Notifications
Clear all

Leaderboard problem

6 Posts
2 Users
0 Likes
583 Views
(@isasaurio)
Posts: 29
Eminent Member
Topic starter
 

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!!!

 
Posted : 20/06/2018 10:42 pm
(@isasaurio)
Posts: 29
Eminent Member
Topic starter
 

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"?

 
Posted : 20/06/2018 11:23 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

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

 
Posted : 20/06/2018 11:28 pm
(@isasaurio)
Posts: 29
Eminent Member
Topic starter
 
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";
}
});
}
 
Posted : 20/06/2018 11:33 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

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

 
Posted : 20/06/2018 11:39 pm
(@isasaurio)
Posts: 29
Eminent Member
Topic starter
 

It worked!!
Thank you so much!!!!
Greetings from Chile

 
Posted : 20/06/2018 11:50 pm
Share: