Want to replace a destroyed object with another object

Hi I have just started learning Unity and wish to know the script or how to first destroy and an object and then the destroyed object being replaced by another object.
Basically I need a star object to replace the destroyed one.

Here is my current working script which at the moment only deletes the destroyed object.

Many thanks

using UnityEngine;
using System.Collections;
public class clickcontrol : MonoBehaviour {
public static string nameofobj;
public GameObject objnametext;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
void OnMouseDown()
{
nameofobj = gameObject.name;
//Debug.Log (nameofobj);
Destroy (gameObject);
Destroy (objnametext);

}
}

8727864–1180782–clickcontrol.cs (448 Bytes)

The general pattern would be something like…

var obj = Instantiate(starPrefab);
obj.transform.position = transform.position;
Destroy(gameObject);

You may want to set the star’s parent so that it follows along with the parent of the original object. In that case, you’d do this instead:

var obj = Instantiate(starPrefab);
obj.transform.SetParent(transform.parent);
obj.transform.localPosition = transform.localPosition;
Destroy(gameObject);

starPrefab should be a public GameObject field. Drag a prefab into the slot in the inspector so that it can be instantiated.