2D collider side detection

Hi,

I’m making a 2D platformer. In the game there are these cube platforms. How can I make it so that the game detects accurately what side the player is colliding with? I’ve tried making child colliders to the platforms sides, but this is prone to bugs. If the player lands just on the corner of the cube, it might collide with both colliders (2. pic). And if the player lands fast on top of the cube on the edge, it somehow goes through the blue collider, and collides with the red collider (3. pic).

Is there a better way to make this mechanic, so that it would be accurate and bug free?

void OnCollisionEnter2D(Collision2D c)
{
	if (Vector2.Dot(c.GetContact(0).normal,Vector2.left)>0)
		Debug.Log("We just hit the left side of something");
	else if (Vector2.Dot(c.GetContact(0).normal,Vector2.right)>0)
		Debug.Log("we just hit the right side of something");
	else if (Vector2.Dot(c.GetContact(0).normal,Vector2.up)>0)
		Debug.Log("We just landed on top of something");
}