WaitforSeconds OnClick()

Is there a way to deactivate a button (game object) on the click of the same button, then wait a set amount of time then the button reactivates?

I’ve been trying to use WaitForSeconds but I cant get it to appear in the on click() menu. Is there an alternative to WaitForSeconds? Maybe a time counter?

I imagine it has something to do with WaitForSeconds being a coroutine. I haven’t actually done what you’re trying to do before exactly, but would something like this work?

public void Delay (){
    //Set interactable to false here
    StartCoroutine (Reactivate());

IENumerator Reactivate (){
    yield return new WaitForSeconds (waitTime);
    //set interactable to true here

When you click on the button, have it run Delay()