i am a noob trying to make a basic tennis game and want the player to catch the ball if it falls. i set up a catch collider but it catches the ball the instant its thrown. how do i make the collider wait a second after the button was pushed to be activated?
use coroutine to add a delay before activating the collider:
private void OnButtonClicked()
{
StartCoroutine(DelayCollider());
}
private IEnumerator DelayCollider()
{
yield return new WaitForSeconds(1f);
this.GetComponent<Collider>().enabled = true;
}