Boolean check time in collider

Hi, I’m new to unit, I was thinking if it is possible to check how long a collider is in a trigger collider?

For example:

Collider 1 is less then 1 second in collider 2(trigger). If less then 1 sec then score -1, if longer then 2 sec do nothing.

Yes it is possible but you need to write some code.

  • OnTriggerEnter : set a float value to 0
  • OnTriggerStay : increment the float value with Time.deltaTime and do your stuff if needed