- Home /
Game Pauses when I teleport player
Hello. I am trying to teleport the player to a specific location which is loaded from playerprefs but for some reason everytime I start the game, it pauses and does not teleport the player.
void Start(){
x = PlayerPrefs.GetFloat("PlayerX");
y = PlayerPrefs.GetFloat("PlayerY");
z = PlayerPrefs.GetFloat("PlayerZ");
player.transform.position = new Vector3(x, y, z);
Debug.Log("changed player");
}
Thanks in advance!
Answer by BBIT-SOLUTIONS · Mar 20, 2020 at 06:36 PM
The code you've attached looks actually correct (as far as you have created the 3 floats in the PlayerPrefs before). So the pausing of your gaming is probably caused by something else.
Do you get any errors or warnings and could you maybe give a bit more information?
Answer by kaancetinkayasf · Mar 20, 2020 at 08:00 PM
Please share at least the code which you are pausing the game with and then maybe i can help.
Your answer
![](https://koobas.hobune.stream/wayback/20220612225350im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Clearing out an objects force when trying to teleport it. 3 Answers
How to change level and spawn player into coordinates? 1 Answer
How to make an object move after teleporting it to a specific location 1 Answer
How to teleport one game object to another with offset? 1 Answer
How to detect whether a portion of the screen is touched 1 Answer