The purpose of this project was to debug a program provided through Unity's Jr. Programmer course. I looked through the program and found the following errors:

  1. The program did not start.
  2. The text did not change from "Congratulations" to "All errors fixed," even though it was intended to switch every few seconds.
  3. The original creator made a RotatingSpeed variable, but did not apply it to anything.


I scanned the code and realized that the errors were caused by:

  1. Improper coding syntax (missing semi-colon, bracket, incomplete formatting for creating a List, missing namespace).
  2. One If-Statement was placed inside of another. Separating them from each other made more sense logically.
  3. I applied the RotatingSpeed variable to the text.

How did I figure out that the if-statements needed to be separated? 

  1. The text uses a List that contains two different phrases: "Congratulation" and "All Errors Fixed".
  2. A parameter is passed through this List in order to determine which phrase to display at a given time. 0 for "Congratulations" and 1 for "All Errors Fixed."
  3. A line of code dictates that a variable, starting from 0, should increase as time passes.
  4. The next line of code, the first If-Statement,  states that if 1.5 seconds were to pass, the variable resets to 0, while a separate variable increases by 1. In contrast, this integer is a variable, and acts as a parameter that is then passed through the List and allows for the text to change from "Congratulation" to "All errors are fixed."
  5. The next If-Statement states that if this integer goes beyond the total amount of items in the List (being 2), the integer resets to 0. This causes the "All errors are fixed" to swap back to "Congratulation." Since the first statement also goes back to 0, and proceeds to increase as time passes, an endless loop is created between the two phrases.

Why were there two If Statements? Couldn't you use Time as the parameter and pass that through the List to change the text? Why did you need to make two variables?

  • I believe that time needs to be converted first to an integer, in order for it to be passed through as a parameter in the List. Time by itself is a float, and cannot be used in a List.

Leave a comment

Log in with itch.io to leave a comment.