Changing player position when changing scene
hi, im making a 2d top down game however I have a problem, its hard to explain but il try and make it sound as simple as possible:
I have a player who is in the middle of a room (Scene1) which has multiple doors.
the player enters one of these doors and it takes them to Scene2.
In Scene2 there is a door behind the player (the one they had just entered).
The player enters the door behind him taking him back to Scene1.
My problem is when the player re-enters Scene1 I would like the player to be standing infront of the door he had just came out of , however as the scene switches, he still remains in the middle of the room where he spawns, when the game started
Does anyone have any idea of how this problem can be fixed as I cant find any videos on it..?
Thanks :)
Answer by tormentoarmagedoom · Jan 25, 2019 at 11:08 PM
Good day @hathk
You need to create a gameobject with a script to store all informarion you need to know. This object must have the DontDestoyOnLoad property.
You need to watch the Unity Tutorial about PERSISTENCE DATA.
Good luck.
Bye