Issue: Score = -2147483648

I am not sure what is the issue but my Score = -2147483648

   public int CalculateScore()
    {
          return Mathf.RoundToInt(correctAnswer / (float)questionSeen * 100);
    }

This happens when questionSeen is 0. Then you are dividing by 0 and strangeness happens to the result. You should check the logic because unless you are calculating the score in Update - which you don’t need to do - it appears this is run before questionSeen is updated

1 Like

Thank you so much, @bixarrio. I went back to my code and found the issue. In void GetNextQuestion(), I was calling the wrong increment function.

    void GetNextGuestion()
    {
        if (questions.Count > 0)
        {
            ...
            scoreKeeper.IncrementQuestionSeen();
        }

    }

Good job, and thanks for sharing your solution! :slight_smile:

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

Privacy & Terms