Hi guys. Is it possible to display the textfield when the button is click? i want that my scene is hiding the textfield when it is played then when the button is click, that’s the time the textfield will appear. where will i put the code if it is possible? here is my code. just edit it if you want.
using System;
using UnityEngine;
using System.Text.RegularExpressions;
using System.Collections;
public class bedA : MonoBehaviour {
public static string kamaA="";
public Texture background;
public GUIStyle Next;
public GUIStyle Back;
public GUIStyle Yes;
public GUIStyle upuan_style;
public float guiPlacementX1;
public float guiPlacementY1;
public float guiPlacementX2;
public float guiPlacementY2;
public float guiPlacementX3;
public float guiPlacementY3;
void OnGUI(){
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), background);
kamaA = GUI.TextField (new Rect (318, 295, 240 , 45), kamaA);
kamaA = Regex.Replace (kamaA, "[^0-9]", "");
if(GUI.Button(new Rect(Screen.width* guiPlacementX1, Screen.height*guiPlacementY1, Screen.width*.2f, Screen.height*.15f),"", Back)){
Application.LoadLevel("Choice1");
}
if(CheckInput(kamaA))
{
if(GUI.Button(new Rect(Screen.width* guiPlacementX2, Screen.height*guiPlacementY2, Screen.width*.2f, Screen.height*.15f),"", Next)){
Application.LoadLevel("5bedB");
}
}
}
bool CheckInput(string data)
{
bool result = false;
int convertedData = 0;
if(Int32.TryParse(data, out convertedData))
{
if(convertedData >= 0 & convertedData <= 2)
result = true;
}
return result;
}
}