How to have two of the same UI Text?

The title is a little confusing, but I want to have two texts displaying the player high score, one when he pauses the game, and the other displaying the hi score in the game over screen.
I made it work by the only way I currently know, but I guess its not a convenient and efficient way to do it. Script:

public class LevelManager : MonoBehaviour {

    public static LevelManager instance;
    public Pause pauseScript;
    public GameObject gameOverText;
    public Text scoreText;
    public Text highScore;
    public Text highScore2;

    private int score = 0;


    void Start() {

        highScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
        highScore2.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
    }

If you know the proper cleaner way to set it up, I appreciate it. Thank you in advance, have a great year :slight_smile:

You did it the cleanest possible but you should keep:

     highScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
     highScore2.text = PlayerPrefs.GetInt("HighScore", 0).ToString();

in the update function.

If you want you could do:

     highScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
     highScore2.text = highScore.text;

I would make a array of texts:

public UnityEngine.UI.Text[] highScoreTexts;

And then make a method to update all of them with the same value:

public void UpdateHighScoreTexts ()
{
    //Looping through all texts
    for (int i=0; i < highScoreTexts.Length; i++)
    {
        highScoreTexts*.text = PlayerPrefs.GetInt ("HighScore").ToString();*

}
}
Hope it helps! :slight_smile: