using UnityEngine;
using System.Collections;
public class ClickButton : MonoBehaviour {
public string Previous = "";
public GameObject PopUp;
void OnMouseDown()
{
Destroy(GameObject.Find(Previous));
Instantiate(PopUp);
}
}
Everytime I run and click on the button the clone object stays and instantiates the new object however if the object is not a clone it works fine. However it being a clone is necessary