Getting all colliders from a object.

I have a gameobject attached a box collider,
how do I get all colliders to a array from the box collider?
for a example,
If I have a gameObject called “Character” and attached a mesh Collider.
how do I count how many collisions is happening?
or if I want to check is there any collider on it,
how do I code?
(sorry my expressing is not very well)

var colliders : Component = gameObject.GetComponentsInChildren(Collider);
1 Like

Collider[ ] colList = transform.GetComponentsInChildren();

Another route is to make use of the Collider.OnCollisionStay or Collider.OnCollisionEnter event functions. They both include a Collision parameter which contains information such as all contact points of the collision.

You could also add Collision.collider to a list during OnCollisionEnter and remove it during OnCollisionExit to generate a list of all colliders that an object is colliding with at any given time.