Hi, I am trying to make two circle collide between them, and detect the collision in a script receiving a Debug.Log in the console. Each of them has a Dynamic Rigidbody2D and a CircleCollider2D components. When the two circles collide, the collision response from the physics engine is correctly made, but in the console nothing appears.
Here’s my code:
public class mandc : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
GetComponent<Rigidbody2D>().velocity = new Vector3(0, 1, 0);
}
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("OnTriggerEnter2D");
}
private void OnTriggerStay2D(Collider2D collision)
{
Debug.Log("OnTriggerStay2D");
}
private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("OnCollisionEnter2D");
}
private void OnCollisionStay2D(Collision2D collision)
{
Debug.Log("OnCollisionStay2D");
}
}