Scoring only one or zero in one InputField?
Hello Good old Unity community!
My problem is that I don't know how to score only zero or one point in one InputField. I have loads of inputFields in one scene. If the player answers correct he gets +=1 point and if he answers incorrect he gets -=1 point.
How do I make it so that a player can only score one or zero points. Now the player can erase his answer and get more points than one for one question. I got different code for every InputField. Here is my code for the first InputField:
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Math1: MonoBehaviour {
public InputField iField;
public string myAns;
public int myScore;
public void Text_Changed(string newText)
{
myAns = iField.text;
if (myAns == "15")
{
Debug.Log("Correct Answer");
ScoreManager.score +=1;
}
else
{
Debug.Log("Incorrect");
ScoreManager.score -=0;
}
}
}
Thank you!!
Comment