Problem passing through bottom of platform

I created a script that checks if any platforms with the pass platform tag enters a collider surrounding the player object. Then I store the platforms in a list and ignore collision between all the parts of player and them if the players lowest point is less than the platforms position and do the opposite if its greater. Problem is it only works sometimes. Even though the players bottom most point is greater than the platform it still falls through it.

Here’s the code I use for it in update.

//run through all plats to see if collision with them should be ignored or not
foreach (Collider2D plat in plats) 
{
	//if bottom most point is higher than highest point of plat
	if ((bmllp > plat.transform.position.y && gi == false) || 
	    (bmllp < plat.transform.position.y && gi == true && GetComponentInParent<Rigidbody2D>().velocity.y >= 0))
	{
		//dont ignore collision between all parts and plat
		foreach (Collider2D p in parts)
		{
			Physics2D.IgnoreCollision(p, plat, false);
		}
	}
	else
	{
		//ignore collision between all parts and plat
		foreach (Collider2D p in parts)
		{
			Physics2D.IgnoreCollision(p, plat, true);
		}
	}
}

I think it might have something to do with the platform being too thin, since when I increase the platforms size the desired result seems to be more consistent. But I would prefer to keep the platform thin, any advice on what to do would be appreciated.

So, the problem is likely the time step. Since games work by updating each frame, it’s possible that you can fall from (for example) 3.01 to 2.99 in a single frame. So you probably want to give it a bit of leeway, or look into the interpolation methods for rigidbodies.

The other thing I notice is that you check > (greater than) and < (less than) but not if they are equal. You should probably change one of those to <= or >=

Since (it seems) you are creating 2D content and using 2D system, why not try using platform effector?