- Home /
GUI Textfield not accepting input once Compiled
I have no idea why this isn't working, I guess maybe its like similar problem I encountered with my projector.
I created a GUI box with a label, textfield and submit button. Now it works perfectly in Unity editor when you select play to run your game, input is accepted and if it matches it returns correctly. But as soon as I build and run the game, even if you select the textfield, nothing happens when you type and I have no idea why it would do that. Any ideas?
Here is some of the code I've written minus out the OnGUI() and some other non related stuff.
//showGUI content for questionmark 1
if(showQuestionMark1){
//setup box, label and input for questions.
GUI.Box(new Rect((Screen.width/2)-150, Screen.height/2.8F, 300, 225), "Answer Correctly to Increase Happiness" );
GUI.Label(new Rect((Screen.width/2)-140, Screen.height/2.55F, 265, 100), EquipFoodReg.question1);
questionInput = ""; //reset in case input contains previous data
questionInput = GUI.TextArea (new Rect((Screen.width/2)-100, Screen.height/2.2F, 200, 100), questionInput);
//submit handles the input and checks against the answer
if(GUI.Button(new Rect((Screen.width/2)-40, Screen.height/1.68F, 75, 25), "Submit")){
if(questionInput == EquipFoodReg.answer1){
showQuestionMark1 = false; //make disappears
showCorrect = true; //show correct box.
happiness.addHappiness(questionRightIncrease);//increase happiness
//if incorrect.
}else{
showQuestionMark1 = false; //make question disappear
showIncorrect = true;//show incorrect box
}//end if string compare
}//end submit
}//end show questionmark 1
There is a button which triggers this question input and another flag to show buttons for correct and incorrect. Submit works, but always results in incorrect in compiled versions, but works as expected in unity editor play.
Your answer
Follow this Question
Related Questions
Set name for game 0 Answers
How to speed up TextField input? 0 Answers
Fix Blurry UI text? 10 Answers