- Home /
Question by
$$anonymous$$ · Feb 03, 2013 at 06:16 PM ·
objectdestroyspecific
Destroying specific game object. HELP!!!
How can i destroy a specific game object
Script: var PickupGUI : Transform;
function Start () {
}
function Update () {
}
function OnMouseEnter ()
{
Instantiate (PickupGUI);
}
function OnMouseExit ()
{
Destroy(PickupGUI);
}
Comment
Best Answer
Answer by Wolfram · Feb 03, 2013 at 06:28 PM
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.
@$$anonymous$$ set the answer as accepted.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092105im_/https://answers.unity.com/themes/thub/images/avi.jpg)