Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by shads11858 · Oct 31, 2013 at 03:43 PM · guiguitexttextfield

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Set name for game 0 Answers

What's wrong with my function? It keeps telling me 'loseText' is not a member of 'UnityEngine.GUIText'. Please help, please and thank you! 0 Answers

How to speed up TextField input? 0 Answers

Fix Blurry UI text? 10 Answers

Input not registering while TextField is selected 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges