Doors and Multiple Scenes - 2D

I’m making a 2D PixelArt Survival-Horror/Platformer, and I just got death and respawning to work, but:

How do I add this:?
I want to make it so when you’re in proximity of the door, you press E and then an animation plays when the door opens and then it fades to black and fades back and you’re in next scene.

It sounds simple probably like:

play animation ("Door_Open")

fade to black

load scene ("Scene_02")

fade back

Please, clarify what I have to write, please.

so it depends on what you want it to look like, yes your right

create a new animation called door open, make it then do to open the door.

actually for this simple a thing you dont have to use animations persay. animation is just code after all. you can actually just write out the code to open the door.

a door opens along it’s y axis edge normally 90 degrees.

create a “door” or rectangle just for testing purposes.

add a script that basically says this.

//while close enough, there are a lot of ways to do this the easiest is a distance check

if (vector3.Distance(player.transform.position, door.transform.position) < MaxDistance && input.getbuttondown "Action Key")

//you’ll notice i use getbuttondown, not getkey or getkeydown or getbutton.
//thats because you shouldn’t use getkey, it prevents you from easily redefining the input,
//you don’t use getbutton or getkey because the door would open multiple times unless the player
//clicked REALLY REALLY fast, get key/button is for holding stuff down, get x down is for
//whenever a player should only click a key not ever hold it down.
//if you want E to be the default key for action key or whatever you want to name it.
//go into unity, edit->project settings-> input, thats the list of buttons and names and such
//add a new input by changing size or take over an existing one and make it so the name is
//action key or whatever you wish to call it and the positive button is e

//now we rotate the door, first we find the doors edge, thats simply from the middle of the door to one half the width of the door. You could also create an empty game object placed on an edge and rotatearound that. one half an objects size is so common its built in, its called its extents.

vector3 point = door.transform.position + new vector3(door.collider.bounds.extents.x,0,0);

//this is a point on an edge, hopefully you can see how that works, we take the doors position
/and move along the x axis half the width of the door, if we’d like to get the opposite edge
//we - instead of + the value.

//rotatearound takes a point, an axis, an angle
//our point is what we just found, our axis is the Y axis, up and down because thats the axis
//doors rotate around, our angle is 90 because a door opens 90 degrees.


//except this opens the door instantly, you can lerp to rotate slowly by changing that 90 to
//a variable like time.deltatime and that will rotate it a small amount each frame, then you want //to just check the angle and if its over 90 stop.

//alot of explanation here but its like 4 lines of code, i just want to make sure you understand
//what your doing and aren’t just regurgitating my code.