Is the “ground” game object assigned to the “Ground” layer? Please share a screenshot of what you see. Also share a screenshot of your entire console window while your game is running. I’d like to see if “Touching ground” appears there and if the message filters are enabled/disabled.
Also test the “Ground” layer with myRigidBody
. See here. If it does not detect the “Ground” layer either, the PolygonCollider2D very likely did not find it either. The Rigidbody2D acts as a compound collider meaning it is affected by both the PolygonCollider2D and the BodyCollider2D.
An if-statment with a simple Debug.Log is sufficient.
The definition of IsTouchingLayers:
Checks whether any of the collider(s) attached to this rigidbody are touching any colliders on the specified layerMask or not.
It might be that your two colliders do detect the ground collider but not the “Ground” mask.