- Home /
 
               Question by 
               GreekHospitalt · Jan 01, 2017 at 05:27 PM · 
                inputfieldpause gametextbox  
              
 
              Pause game on textbox until Enter is pressed
I am working on a Space Quest type game that has text based input. I am having trouble with getting the input, displaying something on a text box, then having the game pause until the enter key is pressed to disable the textbox so the game can continue. What I believe is happening is that because I am using enter to enter text, and to disable the textbox, it is disabling the textbox before I can read it.
 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 
 public class Test_Input : MonoBehaviour 
 {
     public Text textBox;
     public Text inputField;
     public GameObject TextBoxObj;
 
     public void NewInput(string newText) 
     {
         if(newText == "look room")
         {
             TextBoxObj.SetActive(true);
             textBox.text = "You look around the room, it is pretty fucking swag!!!";
         }
     }
 
     void Update()
     {
         Time.timeScale = 0;
         if(Input.GetKeyDown(KeyCode.Return)&&TextBoxObj.activeSelf)
         {
             Time.timeScale = 1;
             textBox.text = "";
             TextBoxObj.SetActive(false);
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Textbox exit on keypress 1 Answer
Use System.Windows.Automation in Unity 1 Answer
How to move text in input field? 0 Answers
How to Show the type gui text to the gui box 0 Answers
Using text box as data store? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                