ButtonHelper.cs 484 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class ButtonHelper : MonoBehaviour
  6. {
  7. private Button button;
  8. private void Start()
  9. {
  10. button = GetComponent<Button>();
  11. }
  12. public void Hide()
  13. {
  14. button.interactable = false;
  15. StartCoroutine(HideAction());
  16. return;
  17. }
  18. private IEnumerator HideAction()
  19. {
  20. yield return new WaitForSeconds(3f);
  21. button.interactable = true;
  22. yield break;
  23. }
  24. }