2D Character falls through ground

Hello. So I’m having a problem with my character detecting the ground.

So I have BoxCollider2D and a RigidBody2D attached to the player and the ‘Is Trigger’ checked on from the boxcollider2d window (this is for detecting if the player is hit). After checking ‘Is trigger’, the player now falls through the ground (which also has a BoxCollider 2D attached) which before it was able to collide with the ground and walk along it.

I’m an absolute beginner in Unity, so it might be a simple fix.
So I’m looking for any fix without taking the ‘Is Trigger’ off.

If You will enable "Is Trigger " then you will pass every other collider. If you still want to make it fall on ground with "Is Trigger " on , you will have to use “Raycasting” to detect the ground.

I cant provide you the script now . BTW what you are trying to achieve ?

You can refer this

Sorry its not in 2D .

I know you probably found the solution , but just to anyone having the same problem passing by, you can have multiple colliders on the same object and my solution to this is to put the non trigger collider at the feet of the object or wherever it is supposed to collide with the ground. If you want it to collide with walls as well you just have to put 2 box colliders , the bigger one would be the one made for detecting the player and the smaller would be to collide with objects

Just disable the Is Trigger and change your script for player hitting and enable IsTrigger on the enemy.