How can i destroy a specific game object
Script:
var PickupGUI : Transform;
function Start () {
}
function Update () {
}
function OnMouseEnter ()
{
Instantiate (PickupGUI);
}
function OnMouseExit ()
{
Destroy(PickupGUI);
}
How can i destroy a specific game object
Script:
var PickupGUI : Transform;
function Start () {
}
function Update () {
}
function OnMouseEnter ()
{
Instantiate (PickupGUI);
}
function OnMouseExit ()
{
Destroy(PickupGUI);
}
You are trying to destroy the prefab object you use for instantiation, not the object you actually instantiated. Store the object returned by Instantiate(), and then destroy that instead.