I am making a survival themed incremental game but I’m not sure how I could make it so when you click the first button, , you have to wait 3 seconds until you can click it again. I am using C# and any help is appreciated
You can use something like this:
bool canClick=true;
public void OnClick()
{
if(canClick)
{
//do stuff
StartCoroutine(ButtonEnabler())
canClick=false;
}
}
IEnumerator ButtonEnabler()
{
yield return new WaitForSeconds(3f);
canClick=true;
}
Let me know if it works.
worked. Thanks