Search Unity

What code is required to make a score system? Also, how to get a text box input checked first.

Discussion in 'Scripting' started by MattCarter24, May 30, 2015.

  1. MattCarter24

    MattCarter24

    Joined:
    May 27, 2015
    Posts:
    120
    Hello there,

    I am a beginner with only a tiny amount of Javascript experience and no C# at all. Please make your explanations very clear, simple and easy to understand.

    I would like to have button that when clicked runs a function that checks the input from a text box to either...

    1) add a point to the score and also bring up a pop up box saying "correct!"

    OR

    2) to not add a point to the score but pop up a message saying "Incorrect!".

    How can I do this?

    Please help! Any help would be much appreciated!

    Thanks, Matt
     
  2. SubZeroGaming

    SubZeroGaming

    Joined:
    Mar 4, 2013
    Posts:
    1,008
    check out int.TryParse.

    This method allows you to parse a string and check for a number. You can then take that number that was in the text field and add it to your points variable. This is fairly simple task. I suggest you freshen up on your logic. Check out my signature for an interactive tutorial series. I have videos on fundamentals, intermediate, and advanced c# unity programming