Counting colliders

Hello, is there a way to count how many colliders are colliding my object at the same time??

The problem is:

I have a character and he can pick up rigidbodies when it touchs one and I press a button but the only way I have to avoid it pick 2 objects at same time is to make the collider small but there is always a chance to pick more than one at once, so is there a way to deny he pickup any objects if there are more than one collider collidiying?



if ( !playerHoldingItem ) {
} else {
  // don't pick up item, he's already got one

That's all pseudocode of course. Just have a check to say you can only hold one item at once.

If you do need to know how many are colliding, in each OnCollisionEnter (or TriggerEnter) increment a variable on the player; then in Exit, decrement that variable.

the proplem not with collider because u cant add 2 collider at same time try it the proplem might be in script or ( adding the same script to multiple object ) try to chick your script