Destroy.cs 373 B

1234567891011121314151617
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Destroy : MonoBehaviour {
  5. //定义时间变量 过了一定时间摧毁生成物
  6. public float DestroyTime;
  7. // Use this for initialization
  8. void Start () {
  9. Destroy(this.gameObject,DestroyTime);
  10. }
  11. // Update is called once per frame
  12. void Update () {
  13. }
  14. }