How to run what's inside OnTriggerEnter temporarily while the two objects are in contact?

void OnTriggerStay2D (Collider2D other) {

		if (other.gameObject.tag == "Hand") {
		
			onHand = true;

		}
	}

So basically, I want onHand to be true only when the two objects are in contact. As soon as they come out of contact I want onHand to be false again. Any easy way to do this?

Use OnTriggerExit2D when an object leaves a trigger collider. You should not just set onHand = false; You will need to check if the GameObject that left is tagged “Hand” because any other GameObject that has collided with the trigger and left will set onHand to false, but the GameObject tagged “Hand” could still be colliding.

void OnTriggerExit2D ( Collider2D other )
{
	if ( other.gameObject.tag == "Hand" )
	{
		onHand = false;
	}
}