discover time length of onTriggerStay

Hi all,

I want to build a VR with haptic device. This device will on if the hand touch an object, and the intensity of the feedback depend of the time length the contact.

Is there any script or strategy to count the time of the contact?

thank you

private float contactTime = 0;

void OnTriggerEnter(Collider other) {
        contactTime = 0;
    }

void OnTriggerStay(Collider other) {
        contactTime += Time.deltaTime;
    }