[Solved] The number wizard project is not working, please help

While going through this lesson, section 2 lecture 20, I inputted the void NextGuess function at the bottom. Afterward I went to check just like in the video and my game now doesn’t work/doesn’t run. I have looked at the code and made sure to have every space, line, even capitalization right but the game will not run. Am I able to get a little help figuring out what went wrong? It will not let me upload the script file, but it is an exact copy of this page (except 18-27 is not skipped)


1 Like

Hey Kyle, how are you?

The problem is that the if and the first else if under the Update method don’t have an closing brace.

1 Like

Nice spot @Joao_Dalvi. :slight_smile:

@Kyle_Carter, here’s an example (have to scroll down a bit for the if / else if);

1 Like

Hey I am doing fine! Just a little confusion since I am new to this. The link showed some similar things (in the lessong) https://github.com/CompleteUnityDeveloper/02-Number-Wizard-Console/commit/0dcb7a7c505d4a3c17a5fdfe64b6140cde0415c1
But I think I closed off the brackets and still there is an error. Tell me if I am wrong. Again I apologize for not understanding that well for coding things at the moment. Hoping to change that though!


Hi Kyle,

Where you have this…

{ else if 

change it to be more like this…

} else if (Input.GetKeyDown(KeyCode.DownArrow))

…obviously changing the condition that you are checking in between the opening and closing brackets ( ) as appropriate in each case…

The curly braces are used to indicate code blocks… so in the case of the if / else if statement

if (some condition is met) 
    // run this bit of code between the curly braces
    // semi-colons are needed on the ends of the lines of code in these blocks
else if (some other condition is met) 
   // run this bit of code between the curly braces instead
   Debug.Log("This is an example");
1 Like

So, did you fixed this issue @Kyle_Carter?

Privacy & Terms