CountDown.cs 300 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class CountDown : MonoBehaviour
  6. {
  7. public float time = 1f;
  8. private void OnEnable()
  9. {
  10. Invoke("Down", time);
  11. }
  12. void Down()
  13. {
  14. Destroy(gameObject);
  15. }
  16. }