Instantiate object OnMouseOver, then delete the instantiated object OnMouseExit.

I would like to instantiate a prefab when my cursor hovers over an object. Then i would like the instantiated object to be destroyed when i move my cursor away. Can anyone give me a solution?

Try this script:

   public GameObject prefab; //attach to this the prefab you want to instantiate

    private GameObject instantiatedObject;

    void OnMouseEnter()
        instantiatedObject = Instantiate(prefab,, Quaternion.identity) as GameObject;

    void OnMouseExit()

Also make sure that the object the mouse hovers has a collider of some sort.