| using System; | 
| using UnityEngine; | 
| using UnityEngine.UI; | 
| using System.Collections; | 
|   | 
|      | 
| public class ButtonClickInterval : MonoBehaviour | 
| { | 
|     [SerializeField] float interval = 1f; | 
|     [SerializeField] Button targetBtn; | 
|   | 
|     private void Awake() | 
|     { | 
|         targetBtn.AddListener(OnClick); | 
|     } | 
|   | 
|     private void OnClick() | 
|     { | 
|         targetBtn.enabled = false; | 
|         StartCoroutine(DelayClick()); | 
|     } | 
|   | 
|     IEnumerator DelayClick() | 
|     { | 
|         yield return new WaitForSeconds(interval); | 
|         targetBtn.enabled = true; | 
|     } | 
| } |