AutoDestory.cs 290 B

1234567891011121314151617
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class AutoDestory : MonoBehaviour
  5. {
  6. public float lifeTime = 1.5f;
  7. void Start()
  8. {
  9. Invoke("DestorySelf", lifeTime);
  10. }
  11. void DestorySelf()
  12. {
  13. gameObject.Destroy();
  14. }
  15. }