How to make a game over scene reload the last scene?

Hi, I have 3 scenes in my game, and a GameOver scene too.

I want to make the GameOver scene reload the LAST scene when I press “X”.
Example: if player dies in scene 2, it reloads the scene 2, but if player dies in scene 3, it reloads the scene 3.

Can someone help me please? Tanks!!

Perhaps this is a newbie approach but will work for sure.
You can try to set a variable which identifies all the scenes, lets say an integer for each scene you have.

Before loading the scene (after player dies), you can get the “last scene” information (using the variable) and decide which scene to load.

Regards