Destroying Objects.

Hi all, i have load multiple objects in my scene. All i have to do is load objects when i press the object icon, i have created this script for instantiate the objects.

using UnityEngine;
using System.Collections;

public class Model : MonoBehaviour
{
	public Transform Table, Chair, Door;
	private Transform Table_Temp, Chair_Temp, Door_Temp;
	public GUITexture Chair_Button, Table_Button, Door_Button;
	private bool Chair_Click = false, Table_Click = false, Door_Click = false;

	void Update()
	{
		if(Input.touchCount > 0)
		{
			if(Chair_Button.HitTest (Input.GetTouch(0).position))
			{
				Chair_Click = true;
				if(Chair_Click == true)
				{
					Chair_Temp = Instantiate (Chair, new Vector3 (0, 0, 0), Quaternion.identity)as Transform;
					Chair_Click = false;
				}
				if(Chair_Click == false)
				{
					Destroy (Chair_Temp);
				}
			}
			else if (Table_Button.HitTest (Input.GetTouch (0).position))
			{
				Table_Click = true;
				if(Table_Click == true)
				{
					Table_Temp = Instantiate (Table, new Vector3 (0, 0, 0), Quaternion.identity)as Transform;
					Table_Click = false;
				}
				if(Table_Click == false)
				{
					Destroy (Table_Temp);
				}
			}
			else if(Door_Button.HitTest (Input.GetTouch(0).position))
			{
				Door_Click = true;
				if(Door_Click == true)
				{
					Door_Temp = Instantiate (Door, new Vector3(0, 0, 0), Quaternion.identity)as Transform;
					Door_Click = false;
				}
				if(Door_Click == false)
				{
					Destroy(Door_Temp);
				}
			}
		}
	}
}

Here its instantiate the objects when i press the icon, but its not destroying. Which means i want to show only one object at runtime, if i press 1st button my first object only will instantiate same as 2 and 3.

Do not check for the Chair_click == false (or the other checks) inside the if(Chair_Button.HitTest (Input.GetTouch(0).position)) statement because it’ll never be false (you’ve just set it true!). Do that outside the if(Input.touchCount > 0) statement.

void Update()
{
   if(Input.touchCount > 0)
   {
      if(Door_Button.HitTest (Input.GetTouch(0).position))
      {
         Door_Click = true;
      }
   // Other hit tests...
   }

   if(Door_Click == true)
   {
      Door_Temp = Instantiate (Door, new Vector3(0, 0, 0), Quaternion.identity)as Transform;
      Door_Click = false;
   }

   if(Door_Click == false)
   {
      Destroy(Door_Temp);
   }

   // Other _Click = true/false checks...
}

And another suggestion. Don’t instantiate and destroy. Create the objects inside start function and then use SetActive().