EndScreen stays active (Quizmaster)

Hi there,

Finished the Quizmaster course and tried it several times, my EndScreen or WinCanvas stays active all the time.
Why? I don’t get it because I have set it up in the script. Maybe just a Noob mistake.

public class EndScreen : MonoBehaviour
{
    
    [SerializeField] TextMeshProUGUI finalScoreText;
    ScoreKeeper scoreKeeper;

    void Awake()
    {
        scoreKeeper = FindObjectOfType<ScoreKeeper>();
    }

    public void ShowFinalScore()
    {
        finalScoreText.text = "Congratulations!\nYou got a score of " + 
                                        scoreKeeper.CalculateScore() + "%";
    }

}

And the GameMandager

public class GameManager : MonoBehaviour
{
    
    [SerializeField] Quiz quiz;
    [SerializeField] EndScreen endScreen;

    void Awake()
    {
            quiz = FindObjectOfType<Quiz>();       
            endScreen = FindObjectOfType<EndScreen>();
    }
    
    void start()
    {
       quiz.gameObject.SetActive(true);
       endScreen.gameObject.SetActive(false);
    
    }

    
    void Update()
    {
       if(quiz.isComplete)
       {
           quiz.gameObject.SetActive(false);
           endScreen.gameObject.SetActive(true);
           endScreen.ShowFinalScore();
       } 
    }

    public void OnReplayLevel()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
}

Hi Amanda,

C# is case-sensitive. Make sure all method names are spelt correctly.

Did this help you fix the issue?


See also:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms