using highscore in next scene

hello people…!
i have a guitext having a script like …

static int score = 0;

    static int highScore = 0;
    static public void AddPoint() {
                score ++;
   
                if (score > highScore) {
                        highScore = score;

                }
        }
    void Start()
    {

        score = 0;
        highScore = PlayerPrefs.GetInt ("highScore", 0);


    }

    void OnDestroy()
    {

        PlayerPrefs.SetInt ("highScore", highScore);


        }

    void Update()
    {

        guiText.text = " " + score + "\nHigh Score: " + highScore;
   
}
}

my first problem is that i want to take those two values (score, highscore)
and use them in my retry/gameover scene!
HOW CAN I DO THAT??

the second problem is that im trying to find a way to make guitext resolution independent and i cant find…
any suggestions??

thanks in advance!

Seems you already know how to use PlayerPrefs, so why can’t you use these scores in your next scene?

i used playerprefs to save my highscore!
how can i use on the next screen though?
im reading the manual and coding!
not some serious level of coding!

assign the text parameter of your text component to PlayerPrefs.GetInt(“highscore”); When you save a value in playerprefs it is always there you just have to assign it somewhere to see it

myText.text = PlayerPrefs.GetInt(“highscore”).ToString();

similar to that.

i understood thank you very much…!
according to the resolution independent gui text??
any suggestions??

There are some settings that you will have to play with. Look into the text ui component in the unity docs. You’ll need to set a max font size and min font size and set up some anchors for scaling. It’s not very difficult and requires no code.

ok i ll give it a try have a nice day ! appreciate your help!

No worries. Best of luck! If you need any more help, just ask. The community is very helpful here