Getting Collader

hello, tell me, is it possible to get this collider from an object that hit the collider in Unity?
That is, Collider A collides with Collider B, and A gets information about Collider B.
Sorry for the translation, I hope you understand what I mean.

Yes the collision callbacks (OnCollisionEnter, OnTriggerEnter, OnCollisionEnter2D, OnTriggerEnter2D) all contain information about the other object in the parameters provided to the method.

1 Like

Thanks for the help, but the question arose: Can OnTrigger work without a rigidbody ?
I’m making a 2D game and don’t use rigidbody

If you look at the charts at the bottom of https://docs.unity3d.com/Manual/CollidersOverview.html you will see the conditions under which trigger messages will be sent.

Short answer is you need at least one Rigidbody. It can be kinematic though.

1 Like

Okay, thanks for the help.