I have some code that should let me drag a GUItext gameobject unto the inspector so I can keep count after each object is destroyed. The Count should go up by 1 for each object destroyed by my rockets.
using UnityEngine;
using System.Collections;
public class CountDestroy : MonoBehaviour {
public int Count;
public GUIText countText;
void Start(){
Count = 0;
countText.text = "Count:" + Count.ToString();
}
void FixedUpdate () {
if (rigidbody.velocity.magnitude > 12){
Destroy(gameObject,1);
Count++;
countText.text = "Count:" + Count.ToString();
}
}
}