What is the better method between Physics2D.OverlapCircle and OnCollisionEnter2D to decide whether the player is on ground?

One way you can do it is

OnCollisionStay2D (collision col){ if(col.tag=="floor" && this.rigidbody2d.velocity.y <0.1){ isGrounded=true; /only true when player is colliding with the floor and is not falling/ }

}

The reason to include the test to see if the player is falling is cause sometimes you're cooking with the side of a collider with the tag "floor", and you wouldn't want the player to be considered "is grounded" if his right side is colliding with a floor tile but his feet are off the ground.

Hope that makes sense. That's what I did in a recent game I was making, I'm very much an amateur, might be important to state that, so there are probably better ways. I'm not good with raycasting which is why I didn't use that method.

/r/Unity2D Thread