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)