Answer the question
In order to leave comments, you need to log in
Online Highscore how to make names and values not repeated?
Created an Online Highscore based on this video tutorial
www.youtube.com/watch?v=UvKLmQ6VAtg
public void SaveScores()
{
uniqueID = "A"+Random.Range(1,30000000).ToString();
name3 = userName.text;
score = Mathf.Round (scoreValue.scoreman);
}
Answer the question
In order to leave comments, you need to log in
If you want to allow the player to update their score, generate a key locally with the user that is unique and permanent. Send the key along with new results. When writing to the database, check if the name-key matches, if it matches, update the result.
With the uniqueness of names, everything is as simple as that, either make the name field in the database unique and then the database will not allow you to make a duplicate by issuing an appropriate error, or before adding an entry to the database, check whether there is already such a name in the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question