help in animation/code

I am try to make puzzle game were you need to find paper from book so in each level bit of the book
what need to is how can make object when get colse to it it gose and the door open any thing will help thank you

Attach a collider object to the player and the cube. Write a script that you will attach to the cube. The script should check for a collision with a game object with the tag “Player” or whatever your player object is tagged as.

Once the collision occurs, have the animation play using animation.Play();.

Then destroy the cube with Destroy(cube).