OnTriggerStay2D and keypress not working together

Hello. Trying to do something to an object while that object is in a 2d trigger collider but not until a button is pressed.

Ive done ALOT of experimenting on this. it looks like values will not update once they are in the trigger collider function, including values that are calculated outside of the ontrigger if the function or value is called inside the trigger.

I think if the following code can work, I can figure the rest on my own. The desired result is that when elements are in the trigger and the button is pressed, the console has logged. The variable in the trigger never equals true though for some reason. I have tested this by logging the variable both in and out of the update function.

private void Update() {
    if (Input.GetKey(KeyCode.Space)) {
        testIt = true;

    } else {
        Debug.Log("not held");
        testIt = false;

    }

}

private void OnTriggerStay2D(Collider2D otherObject) {
    if (testIt) {
        Debug.Log("meow");

    }

}

Im using unity version 2019.3.0f6 personal

Okay. I found an answer online. However, this should really be stated in the documentation somewhere on trigger.

If you have an “if check” inside a ontriggerstay2d checking a bool value and the first result doesnt affect anything that is currently in the trigger area, you are essentially putting the rigidbodies to sleep that ARE in the current area. I think this is done to prevent a billion objects from being in a trigger area and just having massive checks here.

So the way to fix this is to make sure all rigidbodies you want to be potentially affected later need to have the sleep mode set to never sleep. Or maybe theres a more clever way like telling themnot to sleep while in the trigger zone and change them back on exit. Idk…im tired.

Reference link: