Question by
parker_griggs · Feb 18 at 10:12 AM ·
rigidbody2dtagoncollisionentercollision2d
How to connect onCollisionEnter with another rigidbody via tag,Problem with collision touching a rigidbody
I have been trying to work on my collision for the object in my game so where it touches a surface (in this case a tilemap surface) it will destroy the bullet, but I am confused on how to set the rigidbody that it needs to destroy to the surface does anyone know how to properly use Collisions2D.gameObject.tag
?
void onCollisionEnter( Collision2D Other )
{
if( Other.gameObject.tag == "Tilemap" )
{
Destroy(this.bullet);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613053143im_/https://answers.unity.com/themes/thub/images/avi.jpg)