- Home /
Question by
Pranith100k · Aug 17, 2021 at 11:35 PM ·
unity 2dprogramming
how to detect a colision on a game objet 2d
i have two box colliders on my player and my enemy and how do i register a collision between the player and the enemy
Comment
Answer by logicandchaos · Aug 19, 2021 at 02:56 AM
Collisions happen automatically, both objects need colliders and at least one object needs a rigidbody. There are callbacks to the collisions that you can use in your scripts: OnCollisionEnter, OnCollisionExit, OnCollision, there are also triggers and 2d and 3d methods.
Your answer
![](https://koobas.hobune.stream/wayback/20220613041810im_/https://answers.unity.com/themes/thub/images/avi.jpg)