Check for collision with ignored layer

I want to prevent collisions with platforms when the player is moving upwards, and enable them when they are moving back down. I have achieved this by putting the platforms on a seperate layer and enabling/disabling IgnoreLayerCollision between the player and platform layers depending on direction. This in general is working, however if the player changes direction when half way through the platform the player will suddenly ping off in a direction or gets stuck.
Is it possible to detect for this collision before enabling the collision layer? or is there another way to achieve this?

Depending on the shape of your character’s collider you can use the various Physics.OverlapXXX methods. There are also Physics2D versions if this is a 2D game.

Many thanks that worked for me. My player character uses a capsule collider, its annoying you can’t just pass that in, but I found some code to convert the collider to the points that method needs.