Keep the players position constant between two different levels
In my game the player jumps between two different levels with the same layout at the hit of a button. What i want to happen is for the players position to stay constant between two levels (if player is top right corner in level A, theyll be top right corner in level B when they change). I have some sort of an idea of how to do this, but i dont have the programming skills to actually do it.
What I was thinking that could be done is using a variable that stores the players position when the level changes and every time the level starts, the player prefab fetches that variable and applies it to its position.
If anyone can help me out with this, I would be very appreciative :D
Answer by Sneakki · Nov 21, 2015 at 08:18 PM
I could advise you to use a Static variables in a class.For example call the class Statics and apply it to empty objects-preferably on both levels.... and remember the position of the player every time you want to change level in that class.When the new level opens just initialise player position with that static variables from the class
Your answer
Follow this Question
Related Questions
How to prevent the player to move beyond certain x-position value 3 Answers
Im trying to teleport my player between two spots - How do I do this? 1 Answer
Moving simultaneously with UP LEFT, W D using GetAxisRaw. Rotating localScale to flip animation 2 Answers