Unity2d - Player wont teleport to the positon after saving x/y positions with player prefs

Hi I am working on a 2d turn based rpg game in unity. I am trying to get unity to save what scene the player was and where the player was inside of the scene after switching back from a fight scene. I have managed to get unity to remember what scene the player was in but the position of the player does not seem to be saved in player prefs. Here is the code for the saving and loading if the players position.

    void Start()
        Player.position = new Vector2(PlayerPrefs.GetFloat("lastPlayerPosX"), PlayerPrefs.GetFloat("lastPlayerPosY"));
 void OnTriggerEnter2D(Collider2D other)

        if (other.CompareTag("Player"))
            currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
            PlayerPrefs.SetInt("SavedScene", currentSceneIndex);
            lastPlayerPosX = Player.position.x;
            lastPlayerPosY = Player.position.y;
            PlayerPrefs.SetFloat("LastPlayerPositionX", lastPlayerPosX);
            PlayerPrefs.SetFloat("LastPlayerPositionY", lastPlayerPosY);


        IEnumerator Loadscene()
            yield return new WaitForSeconds(1.5f);

I serialized the LastplayerX/Y and the values where updating to the players position.

Player.position = new Vector2(PlayerPrefs.GetFloat(“lastPlayerPosX”), PlayerPrefs.GetFloat(“lastPlayerPosY”));
// …
PlayerPrefs.SetFloat(“LastPlayerPositionX”, lastPlayerPosX);
PlayerPrefs.SetFloat(“LastPlayerPositionY”, lastPlayerPosY);

Your Registry entry names/PlayerPrefs variable names are…


when loading and


when saving.