Detect if a collision is no longer occuring

I have some code that works well to detect the collision, which follows the basic form of:

public class Holding : MonoBehaviour {
	void OnCollisionEnter(Collision collision) {
		obj = collision.gameObject.name;
	}
}

But how would I then unset obj when this collision is no longer happening? The only solution I can think of would be to set and reset this variable every frame, but that seems very inefficient.

I believe you are looking for OnCollisionExit().

void OnCollisionExit(Collision collisionInfo) {
    obj = string.Empty;
}

Also, I’d suggest caching transform or gameobject instead of name - string.