OnCollissionEnter2D not being called

I am currently working on a 2D project it always worked fine. Today, OnCollissionEnter2D isn’t being called anymore. I didn’t really change anything with the colliders or anything. The only thing I did is, that I set Gravity Scale to 0 on one of the rigidbodies, but it is being set to 1 again by a script before any collissions happen. Physics still work (after gravity scale is set to 1). The objects still collide with each other. It’s just, that the function isn’t being called. Here are the rigidbody and the Collider of one object:

And the second one:

I tried this code in the script of the second object:

private void OnCollisionEnter2D(Collision2D collision)

There is no Output. I can see the objects collide, but the function is not being called. Please help

You need to put the script on the other object hitting the object.