I’m trying to access the TextField component so I can compare that int value to another variable. I have set the TextField GUI to only accept int values/string, but I have no clue how to compare the number that the user inputted with a separate variable. (I’m sorry if this is confusing).
#pragma strict
public var Score : int = 0;
public var GameManagingObject : GameObject;
public var UserInput : GameObject;
public var UserInputInt : UI.InputField;
private var gameManager : GameManager;
public var textMessage : UI.Text;
function Start(){
gameManager = GameManagingObject.GetComponent(GameManager);
UserInputInt = UserInput.GetComponent(UI.TextField);
}
function Update(){
textMessage.text = "Score : " + Score; //"
High Score : " + highScore;
if (UserInputInt == gameManager.AnswerDistance){
Score = Score + 500;
}
if (gameManager.ThrustersNumberOfClicks == gameManager.AnswerNumOfPartsT){
Score = Score + 500;
}
if (gameManager.FuelTankNumberOfClicks == gameManager.AnswerNumOfPartsFT){
Score = Score + 500;
}
}
Assets/ScoreScript.js(14,50): BCE0019: ‘TextField’ is not a member of ‘UnityEngine.UI’.
Thank you in advance.