destroyMe.cs 383 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using System.Collections;
  3. public class destroyMe : MonoBehaviour{
  4. float timer;
  5. public float deathtimer = 10;
  6. // Use this for initialization
  7. void Start () {
  8. }
  9. // Update is called once per frame
  10. void Update ()
  11. {
  12. timer += Time.deltaTime;
  13. if(timer >= deathtimer)
  14. {
  15. Destroy(gameObject);
  16. }
  17. }
  18. }