Multiple Spawn Points,Multiple Spawn Points in one scene

,So I have a game i’m making where there is a main room (scene) and it has little side rooms that come off of it (other scenes). The problem I have is about spawn points. I want to be able to enter another scene, and then when i exit that scene, I spawn near that door, instead of the first place you spawn in the game.

I’ve coded before but never really with C# and I’ve been able to do some v basic code, but this is a little beyond me, as i don’t know the kinds of functions etc.

What I envision is a way to basically say "if (the scene before was scene 1) spawn point = this empty game object near the door, else if (scene before was scene 2 ) spawn point = different object , etc . i managed to do some code that enabled me to input a game object as the spawn point, but i could only do one, and it wasn’t dependent on which scene i exited from.

Can anyone help me with like a basic way to code this? I know people don’t usually get whole things of code in the answers, but if anyone could get me started that would be sick.

There are multiple ways that you can do this, but I think a simplistic approach could be to have a DoorManager class which persists between scenes, you can use DontDestroyOnLoad() to persist. And setup trigger colliders at each door which are have a tag name based on the location to spawn in the next scene and so you would have the position right when you enter the trigger.

void OnTriggerEnter(Collider other){
    if(other.tag == “SouthDoorLobby”){
        positionToSpawn = southDoorLobbySpawnPoint;
    }
}

///After loading
transform.position = positionToSpawn;