URGENT HELP NEEDED

I Currently Participating In A Game Jam And I Need Help Creating Sort Of A Pressure Pad Where If You Put A Crate On It Or If You Stand On It The Button Goes Down And A Door Opens Or Somthing And Once You Get Off Or Once The Crate Gets Off The Door Closes And The Button Goes Back Up, I’m Using 2D Btw
Heres The Code I Used For The Button When Its Not Pressed(I Made 2 GameObjects And Put Then Active And UnActive When Player Gets Off Or Crate Gets Off):

  public GameObject buttonwhenPressed;
   
    void Start()
    {
       
    }
    public void OnCollisionEnter2D(Collision2D collision)
    {
        if(collision.gameObject.tag == "Crate")
        {

            buttonwhenPressed.SetActive(true);

            gameObject.SetActive(false);













        }
       

        if (collision.gameObject.tag == "Player")
        {

            buttonwhenPressed.SetActive(true);

            gameObject.SetActive(false);













        }



    }
    // Update is called once per frame
    void Update()
    {
       
    }

Heres The Code For The Button When Pressed :

 public GameObject whenbuttonnotPressed;
   
   
   
   
    // Start is called before the first frame update
    void Start()
    {
       
    }
    public void OnCollisionExit2D(Collision2D collision)
    {



        whenbuttonnotPressed.SetActive(true);
       
       
        gameObject.SetActive(false);
    }
    // Update is called once per frame
    void Update()
    {
       
    }

Please Help And Ask Q If Your Confused

you didnt say what wasnt working

Everthing

I Just Need To Now How To Do A Button

Nah Like A Pressure Pad My Bad My G

Two video tutorials by Code Monkey:

3 Ways to Open Doors in Unity!

4 Ways to Interact with Doors in Unity! (Key, Button, Auto, Pressure)

Thank You Soo Much Honestly Man I Would Of Never Found These, Thank You