How Do I check if a Bool was True a few moments ago

I’m not sure if this can be done but lets say I have a bool I call:

public bool KITT_SaidThis = false;

I’m wondering is there a way to check if the bool just recently became “false”? In other words lets say it was true for a while but just now became “false” and you wanted to do something like an if check on this condition, something like:

if (KITT_SaidThis == false "just now or 2 seconds ago"){
Do something
}

Is this possible to do?

You could set up a timer that starts when you call the bool true/false.

so it could be something like this :

float KITT_SaidThisTimer = 0f;
bool starttimer = false;

if (KITT_SaidThis == false)
starttimer = true;

if (starttimer == true)
KITT_SaidThisTimer += time.deltatime;

And then you can ask for the value of your timer in the next situation you need it. something like:

if (KITT_SaidThisTimer >= 5f && YOUR CONDITION)
Dosomething;

That will ask if the Timer is bigger or equal to 5f

I just use print so i can see in console history if value was true/false. Very helpful because you can easy detect when it become true/false.

 if (KITT_SaidThis == false ){
 print("Value is true");
 }