Jump off 2D platforms Smash brothers style.

i have been using

void OnCollisionStay2D(Collision2D other) {

        if (Input.GetKeyDown(KeyCode.DownArrow ) == true)
 platform.transform.GetComponent<BoxCollider2D>().enabled = false; //<--- this one works.

   Physics2D.IgnoreCollision(other.transform.GetComponent<CircleCollider2D>(), platform.transform.GetComponent<BoxCollider2D>()); //doesnt work
   Physics2D.IgnoreCollision(other.transform.GetComponent<BoxCollider2D>(), platform.transform.GetComponent<BoxCollider2D>()); //doesnt work


but it simply doesnt work, now if i deactivate the box collider i cant simply turn it back on with an oncollisionexit2d function since it wont know when the collision ended.

the platform parents the other objects it carries with a 1 scale parent to avoid graphical errors.

what would you use ?

OK, thank you very much for your Answer, it helped me develop this :

Here’s the whole class:

public class PassThrough : MonoBehaviour {

    public bool checkcol;
    public Collider2D lastPlatform;
    public string lastPlatformName;

    // Use this for initialization
    void Start () {
        checkcol = false;
	// Update is called once per frame
	void Update () {}

    void OnCollisionEnter2D(Collision2D other) {

        if (other.transform.name != lastPlatformName) {

            Physics2D.IgnoreCollision(lastPlatform, GetComponent<BoxCollider2D>(),false);
            Physics2D.IgnoreCollision(lastPlatform, GetComponent<Collider2D>(),false);



    void OnCollisionStay2D(Collision2D other) {
         if (other.transform.tag=="MovingPlatform")
                if (Input.GetKeyDown(KeyCode.DownArrow))
                lastPlatformName = other.transform.name;
                lastPlatform = other.transform.GetComponent<Collider2D>();
                    Physics2D.IgnoreCollision(lastPlatform, GetComponent<BoxCollider2D>());
                    Physics2D.IgnoreCollision(lastPlatform, GetComponent<Collider2D>());



this class lets my character with 2 hit boxes pass through moving platforms, and re enter them if you touch anything else which will most likely be the case.