I tried using the StartCoroutine to make my pet smile for 1 second when clicked, but after 1 second more, the clicked bool returns several false value for 1 second more. I put yield break after the clicked is returned a false value to break it immediately but still it runs for 1 second more. How do i break it instantly?
IEnumerator PetTouch()
{
if (clicked)
{
emoteMats[1] = emoteMattouched;
this.GetComponent<Renderer>().materials = emoteMats;
yield return new WaitForSeconds(1);
clicked = false;
Debug.Log(clicked);
yield break;
}
}