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?
Thanks.

Try this script:

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

    private GameObject instantiatedObject;

    void OnMouseEnter()
    {
        instantiatedObject = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
    }

    void OnMouseExit()
    {
        Destroy(instantiatedObject);
    }

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