Change image of a button X seconds after a boolean changed?

Hello,

I am wondering how I could change a button’s image (sprite) X seconds after a boolean changed from false to true?

I was thinking of implementing Invoke but this requires a script which should be imported to an object. So I would like to make it automatically. I know about StartCoroutine but have no idea how to use it and to make the button changes its sprite X seconds after a bool is set to true

Any ideas are appreciated :slight_smile:

I would add a private float to the class, and then in your Update function simply have

if (thatBool == true)

{

thisFloat += Time.deltaTime;
if (thisFloat > timeToChangeSprite)  {GetComponent(SpriteRenderer).sprite = newSprite;}

}