How to make buttons

Hello! I’m new in making games with Unity, and I’m stuck somewhere. I’m working on this game where you control a cube and his clones, and you have to get the cube to the door to win the level, but I don’t know what to do in level 3. I need to be able to make a button that makes a wall dissapear when either a clone or a player is on it, and that makes the wall reappear when the clone or the player gets off the button. Can anybody help me with this?

You would place a collider on the button larger than the button itself. That collider will be set to isTrigger(set in inspector). Then you can check the tag of the object inside of the trigger using OnTriggerEnter. If the tag is Player(or whatever the tag is set to) you can disable the doors collider and renderer.

//Button.js

public var door:Transform;  //Add the door in the inspector

function OnTriggerEnter(other:Collider)
{
    if(other.CompareTag("Player"))
    {
        door.collider.enabled=false;
        door.renderer.enabled=false;
    }
}

If you want to make it so the door reappear upon exiting the trigger

function OnTriggerExit(other:Collider)
{
    if(other.CompareTag("Player"))
    {
        door.collider.enabled=true;
        door.renderer.enabled=true;
    }
}