// took from forum: [url]http://forum.unity3d.com/viewtopic.php?p=215575#215575[/url]
private var input = ""; // Empty string.
//private var show : boolean=true; //Initialise une variable boolean à True.
//show=true;
// En gros on chèque chaque frame pour un qu'on press enter. Je sais pas si le reste du code est exécuté après, non. On voit le texte "what is your input".
function Update()
{
if (Input.GetKeyDown (KeyCode.Return)){ //Input.GetKeyDown Returns true during the frame the user starts pressing down the key identified by name.
// Donc vérifie si Return à été pressé.
//La liste de keycode file:///E:/Installed/Unity%202.6/Editor/Data/Documentation/Documentation/ScriptReference/KeyCode.html
//show=!show; // The opposite of the actial value, true become false.
}
}
function OnGUI () // Je ne suis pas certain, mais je crois qu'il invente une function.
{
GUILayout.Label("What's your input?"); //GUILayout.Label Make an auto-layouted label.
input = GUI.TextField (Rect (115, 0, 200, 20), input, 25); // GUI.TextField Make a single-line text field where the user can edit a string.
if input=0
function OnGUI () {
if (GUI.Button (Rect (529,299,-1,0), "You must input text")){ // What show on the button.`r print ("You clicked the button!")`; `r } `r }
}
Do you mean you want to halt play until the user types something or make the computer type as if it is a user or… ?
The player must fill up the field in order to continue.
Do you mean the string has to be a certain length? If so, you could use something like:-
if (input.Length < desiredLength) {
...continue input...
} else {
...next stage...
}