Exit house style pokemon

I wanted to make sure that my player went into a house and came out (the game pokemon style) I made 2 scenes .1 is the landscape and the other is the scene of the house.when I leave the house I find myself at the point where I started as I do with javascript?

You will need to carry something over from one scene to the other to tell it where to appear (like which door you exited from). Otherwise loading a new scene destroys all your current game objects and reloads the new scene. There are two main ways to carry over data… you can keep a GameObject around when switching scenes by calling DontDestroyOnLoad(gameObject), usually in the Start or Awake method of that object. You probably want to put that on your Player game object if it will be carried through all the different scenes. Or you can use static variables in classes, which will maintain their value across scene changes and destruction of their objects.

I tried DontDestroyOnLoad, the problem is that if I leave the house to go back to the previous scene there are 2 player game right because I entered the gameplayer in the previous scene.

and then when switching scene does not match the door

The reason for DontDestroyOnLoad is to preserve data (which door you entered) not the player itself, that’s just a plus when you use it on the character (but then you need to make sure you don’t get duplicates).

You will have to reposition the character when the scene is entered using a function such as OnLevelWasLoaded.