Hello.
Idk why but my highscore script stopped working all of a sudden. I’ve got it set up like this:
In my PlayerMotor script which is attached to the player I’ve got this in my onDeath function:
public void OnDeath()
{
isDead = true;
if(PlayerPrefs.GetFloat("Highscore") < score)
PlayerPrefs.SetFloat("Highscore", score);
deathMenu.ToggleEndMenu (score);
}
Which is casted when the player dies, it also displays a death menu i created where the highscore should be displayed.
So in my DeathMenu script i’ve got:
public Text highscoreText;
public void ToggleEndMenu (float score)
{
highscoreText.text = ((int)PlayerPrefs.GetFloat ("HighScore")).ToString();
isShown = true;
}
And i’ve got a text layer attached to the highscoreText in the inspector window.
DeathMenu and PlayerMotor are two different scripts. The normal score works perfecly fine.
So what could be the problem?