Usually I try to ask something more specific. IE I have already coded it, it doesn’t work, and I ask for solutions. This time I have a more generic question. This time, I need a nudge to help get me looking in the right direction. A google search reveals what seems like a million different ways to do this. What I am looking to do as the title suggests is save scores in a leader board.
Here is an example mock up using UI Text
The gist of what I want to is, store a 10 entry list that the game calls at some point prior to the game over condition. I currently have my score stored in its own gameObject with script called ScoreKeeper. What I want to do is call that score variable, check it against the table, if it isn’t a new high score I just want to display the table, if the score does place in the top ten I want to replace whatever line the score it placed in with a on screen prompt for text input of up to three letters (initials) and write the current score on the correct line beside, thereby dropping the old tenth entry off the list. I want to do this as GUI element in my current scene, so that the action keeps going on just without the player. Until there are 10 scores recorded, I do want it to display dashes in place of Initials and a 6 digit score of 0.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine;
public class ScoreKeeper : MonoBehaviour {
public Text scoreText;
public int score;
private void Start()
{
score = 0;
UpdateScore();
}
public void AddScore(int newScoreValue)
{
score += newScoreValue;
UpdateScore();
}
void UpdateScore()
{
scoreText.text = "Score:" + score;
}
}
I do apologize I really try to have a more formed question before I come to the forums. I am just a bit overwhelmed with variations on how to do this. Any help as far as how to go about doing this is appreciated.