PlayerPrefs not saving after i quiet application

Hi! so i have a playerpreffs thats not saving after i quiet the application and one that does, the code of them look the same (to me), and wondering why its not saving


private GameObject StartPos;
private GameObject PlayerPos;

public Text scoreText;
public Text hiScoreText;

public static float scoreCount;
public static float hiScoreCount;
private float yDistance;

public static float statScore;
public static bool justDied = false;
public static float NewStatScore;

public float pointsPerSecond;

public bool scoreIncreasing;

private void Start()
    StartPos = GameObject.FindGameObjectWithTag("StartPos");
    PlayerPos = GameObject.FindGameObjectWithTag("Player");

    if (PlayerPrefs.HasKey("HighScore"))
        hiScoreCount = PlayerPrefs.GetFloat("HighScore");

    if (PlayerPrefs.HasKey("TotalHeight"))
        NewStatScore = PlayerPrefs.GetFloat("TotalHeight");

private void Update()
    if (scoreIncreasing && playerController.dead == false)
        // points per second
        yDistance = PlayerPos.transform.position.y - StartPos.transform.position.y;
        scoreCount = pointsPerSecond * yDistance;
    if (scoreCount > hiScoreCount)
        hiScoreCount = scoreCount;
        PlayerPrefs.SetFloat("HighScore", hiScoreCount);
    // print out on screen
    scoreText.text = "Score: " + Mathf.Round(scoreCount) + "m";
    hiScoreText.text = "High Score: " + Mathf.Round(hiScoreCount) + "m";

    if (justDied == true)
        NewStatScore = NewStatScore + scoreCount;
        PlayerPrefs.SetFloat("TotalHeight", NewStatScore);
        justDied = false;



here i have 2 player preffs. one thats TotalHeight and one thats Highscore. The highscore one is saving while the TotalHeight isnt. any tips?

Are you sure the highScore is saved after you quit? You have to call this function to actually save the PlayerPrefs between sessions :