Problem with Android Keyboard/TextField

So here’s the code I’m working with:

if(thing_menu == true)
	{
	GUI.BeginGroup(new Rect(screen_width / 16, screen_height / 4, menu_width, menu_height), "");
	GUI.Box(new Rect(0,0,menu_width, menu_height), "");
	save_menu_screen = 1;

	if(GUI.Button(new Rect(0,0,menu_width - (menu_width / 4), menu_height / 7), object_being_manipulated.GetComponent(ObjectScript).object_properties.name))
	{
		rename_prompt = true;
		basic_info_showing = false;
		customize_showing = false;
		recolour_screen_showing = false;
		shrink_down = false;
		thing_menu = false;
	}
	if(GUI.Button(new Rect((menu_width - (menu_width / 4)),0,menu_width / 4, menu_height / 7),"X"))
	{
		shrink_down = true;
	}

		if(customize_showing == true)
		{
		save_menu_screen = 2;
		GUI.Box(new Rect(0,menu_height / 7, menu_width, menu_height / 7),"Red " + red_display.ToString() + "%");
		red_amount  = GUI.HorizontalSlider(new Rect(0,2 * (menu_height / 7), menu_width, menu_height / 7), red_amount, 0.0, 1.0);
		GUI.Box(new Rect(0, 3 *(menu_height / 7), menu_width, menu_height / 7),"Blue " + blue_display.ToString() + "%");
		blue_amount  = GUI.HorizontalSlider(new Rect(0,4 * (menu_height / 7), menu_width, menu_height / 7), blue_amount, 0.0, 1.0);
		GUI.Box(new Rect(0, 5 *(menu_height / 7), menu_width, menu_height / 7),"Green " + green_display.ToString() + "%");
		green_amount  = GUI.HorizontalSlider(new Rect(0,6 * (menu_height / 7), menu_width, menu_height / 7), green_amount, 0.0, 1.0);
		}

	GUI.EndGroup();

	}
	if(rename_prompt == true)
	{
		GUI.BeginGroup(new Rect((screen_width / 2) - (prompt_width / 2), (screen_height / 2) - (prompt_height / 2), prompt_width, prompt_height),"");
		GUI.Box(new Rect(0,0,prompt_width, prompt_height), "Rename " + object_being_manipulated.GetComponent(ObjectScript).object_properties.name + "?");
			if(GUI.Button(new Rect((prompt_width / 6), prompt_height - ((prompt_height / 4) + (prompt_height / 8)), prompt_width / 4, prompt_height / 4), "Yes"))
			{
				rename_screen_showing = true;
				rename_prompt = false;
			}
			if(GUI.Button(new Rect(prompt_width - ((prompt_width / 6) + (prompt_width / 4)), prompt_height - ((prompt_height / 4) + (prompt_height / 8)), prompt_width / 4, prompt_height / 4), "No"))
			{
			rename_prompt = false;
			thing_menu = true;
				if(save_menu_screen == 1)
				{
				basic_info_showing = true;
				}
				else if(save_menu_screen == 2)
				{
				customize_showing = true;
				}
				else if(save_menu_screen == 3)
				{
				build_screen = true;
				}
			}
		GUI.EndGroup();
	}
	if(rename_screen_showing == true)
	{

	GUI.Box(new Rect(0,0,200,200),test_edit);
	test_edit = GUI.TextField(new Rect(50,50,100,25), test_edit, 20);
	keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);

		if(GUI.Button(new Rect(50, 80, 100, 25), "Done"))
		{
			rename_screen_showing = false;
			thing_menu = true;
				if(save_menu_screen == 1)
				{
				basic_info_showing = true;
				}
				else if(save_menu_screen == 2)
				{
				customize_showing = true;
				}
				else if(save_menu_screen == 3)
				{
				build_screen = true;
				}
		}
	
	}

The problem I’m having is the Textfield will NOT show if it has to be switched on or off by a variable being true or false, and the text field that shows OUTSIDE of all the “if” statements is useless because the android keyboard will not pop up. What is going wrong here? Deleting either instance of the opening of the keyboard has no effect, and deleting either instance of the text field has no effect. The debug shows that I AM successfully getting into that code, but it simply does nothing. Obviously all of this is inside “function OnGUI()”.

UPDATE: When I build the game and put it on my phone it all works as intended. The problem is I can’t test anything before building the game, and having to build it and move it to my phone every single time I want to see if something works is just not practical. Unity Remote doesn’t work for some reason, I can see the scene and move around and tap on things as though it knows it’s on my phone, but when it comes to bringing up text fields, they don’t show up in the remote.

UPDATE 2: I still can not change the Strings of anything with the keyboard, and the text field does not show up in the GUI, even after the build.

UPDATE 3:

if(rename_screen_showing == true)
	{

	GUI.Box(new Rect(0,0,200,200),test_edit);
	test_edit = GUI.TextField(new Rect(50,50,100,25), test_edit, 20);
	keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);

		if(GUI.Button(new Rect(50, 80, 100, 25), "Done"))
		{
			rename_screen_showing = false;
			thing_menu = true;
				if(save_menu_screen == 1)
				{
				basic_info_showing = true;
				}
				else if(save_menu_screen == 2)
				{
				customize_showing = true;
				}
				else if(save_menu_screen == 3)
				{
				build_screen = true;
				}
		}
	
	}

the above code makes the text field come up (as a separate GUI, not part of the other group), and with it the keyboard comes up when i press on the text field and when i type on the keyboard it DOES change the text in the field, so it actually does something. HOWEVER, upon saying “done”, it clears all the text and brings the keyboard back up. I don’t know how to stop this endless loop, but if I could figure it out, I would consider this issue solved… enough. Any variables referenced in the new code that don’t make sense were added before function Start ().

UPDATE 4:

When using this code off of the Unity API, everything works as intended. The only differences between my code and this is that mine was in a GUI Group, but I have since removed that, and I also don’t have the button that allows the user to switch between different kinds of keyboards. Can’t anyone help me?

public var stringToEdit: String = "Hello World";
private var keyboard: TouchScreenKeyboard;
var variable : boolean;

function OnGUI() {
if(GUI.Button(new Rect(200, 0, 100, 100),"Activate"))
{
variable = true;
}
if(variable == true)
{
	stringToEdit = GUI.TextField(new Rect(10, 0, 200, Screen.height / 9), stringToEdit, 30);
	if (GUI.Button(new Rect(10, Screen.height / 9, 200, Screen.height / 9), "Default")) {
		keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);
	}
	if(GUI.Button(new Rect(10, 2 * (Screen.height / 9), 200, Screen.height / 9), "Done"))
	{
		variable = false;
	}
}
}

Looks like I have to answer my own question since apparently no one else can figure it out.

if(rename_screen_showing == true)
	{
		if(gameObject.GetComponent(WORK).name_editing == false)
		{
		gameObject.GetComponent(WORK).stringToEdit = object_being_manipulated.GetComponent(ObjectScript).ObjectProperties.name;
		gameObject.GetComponent(WORK).name_editing = true;
		}

	gameObject.GetComponent(WORK).variable = true;
	
	}

This accesses a separate script that can call up the text field.

if(variable == true)
{
game_manager.GetComponent(MENUTEST).object_being_manipulated.GetComponent(ObjectScript).ObjectProperties.name = keyboard.text;
}
if(keyboard.done)
	{
		
		game_manager.GetComponent(MENUTEST).thing_menu = true;
				if(game_manager.GetComponent(MENUTEST).save_menu_screen == 1)
				{
				game_manager.GetComponent(MENUTEST).basic_info_showing = true;
				}
				else if(game_manager.GetComponent(MENUTEST).save_menu_screen == 2)
				{
				game_manager.GetComponent(MENUTEST).customize_showing = true;
				}
				else if(game_manager.GetComponent(MENUTEST).save_menu_screen == 3)
				{
				game_manager.GetComponent(MENUTEST).build_screen = true;
				}
			keyboard_created = false;
			name_editing = false;
			keyboard = null;
			game_manager.GetComponent(MENUTEST).rename_screen_showing = false;
			variable = false;
	}

}


function OnGUI() {

if(variable == true)
{
	stringToEdit = GUI.TextField(new Rect(10, 0, 200, Screen.height / 9), stringToEdit, 30);
	if(keyboard_created == false)
	{
	keyboard = TouchScreenKeyboard.Open(stringToEdit, TouchScreenKeyboardType.Default);
	keyboard_created = true;
	}

}
}

This opens the text field and allows the user to change the object’s “name”. Detects when it can open, then turns off all the booleans and resets the string in this script so the next object can have its name edited.