GameOver panel if statement problem

Hi all,

In my game a scorepanel will pop-up after dying. When a highscore is made, I’m trying to show another highscore panel instead of the standard scorepanel. The problem is that it works correctly but sometimes when a highscore is made, the standard scorepanel will pop-up as well. So both panels will pop-up after a highscore. Not everytime, but most of the times. I can’t seem to figure out what is wrong in my code.

Is there anybody that may have a suggestion to find the problem?

Below is the if statement code for the panels to show after dying.

public void GameOverShowpanel ()
    {
// shows the standard score panel after dying
    if (ScoreManager.instance.GetPrevHighScore () >= ScoreManager.instance.GetScore ()) {

            Debug.Log(" PrevHighScore was: " + ScoreManager.instance.GetPrevHighScore() + ", Score now is : " + ScoreManager.instance.GetScore());

            gameOverAnim = gameOverpanel.GetComponent<Animator> ();

            scoreText.SetActive (false);
            scoreTextCoin.SetActive (false);
            imageCoinOnGame.SetActive (false);
            powerBar.SetActive (false);
            gameOverpanel.SetActive (true);
            gameOverAnim.Play ("FadeIn");


            finalScore.text = "Score: " + "" + ScoreManager.instance.GetScore ();
            finalHighScore.text = "High Score: " + "" + ScoreManager.instance.GetHighScore ();
            finalCoinScore.text = "" + ScoreManager.instance.GetCoinScore();

        // Shows the High Score Panel if a High Score is made
        } else if (ScoreManager.instance.GetPrevHighScore () < ScoreManager.instance.GetScore ()) {

            Debug.Log(" PrevHighScore was: " + ScoreManager.instance.GetPrevHighScore() + ", Score now is : " + ScoreManager.instance.GetScore());

            scoreText.SetActive (false);
            newHighPanel.SetActive (true);

            newHighAnim = newHighPanel.GetComponent<Animator> ();
            newHighAnim.Play ("PanelHolderTransparentAnim");
            audio2.PlayOneShot (partyHornAU, 0.8f);
            StartCoroutine (PartyParticles ());

            newHighTextOnPanel.text = "" + ScoreManager.instance.GetHighScore ();

            ScoreManager.instance.UpdatePrev();

        }
    }

Never mind, found it.
ScoreManager.instance.UpdatePrev(); on line 37 was causing the problem. I think is was called to early so the Previous Highscore was updated to early. I put ScoreManager.instance.UpdatePrev(); on another method that is called a little later after the GameOverShowpanel ()