Finally understanding the OnUserInput

I have done a fair amount of scripting in python, where in that each user input has to be saved as it’s own variable to be used for future coding, and this is the mentality i had doing this task, so i tried creating a separate function (I won’t bore you with it as it was straight up wrong), which would have worked in python (In theory). My solo attempt ended up being identical to Ben’s apart from the passwords and some of the variables.

After i deleted the hideous attempt at the function, i tried running it, and could not get it to go through to the success screen, and about 30 mins of tinkering later i checked the change log and saw the block

        else if (currentScreen == Screen.Password)
    {
        CheckPassword(input);
    }

It was at this point i had my “i understand it!” moment, that OnUserInput was the validation of every time i entered something whilst the game was running not just the input for the main menu, after feeling like a complete mong i inserted it into my code and it ran fine.

3 Likes

This got me as well!!!

I just couldn’t understand how retrieve password inputs after you got to the “Enter Password” part. After I final figured it out, I made the mistake of using an if-else to select the level (instead of CheckPassword(input)). This just lead me to write duplicate methods for both level 1 and 2, which worked but is considered to be bad code.

Privacy & Terms