Why won't my Player load with the correct position and rotation on my android device, but it will on my computer?

So I’m having a problem with the loading of my players position and rotation. I’m using player prefs to save the information as floats. I can Debug.Log() the values and it shows up just fine. However when i build the game out, it does not work… It just send me back to the beginning of the level with 0 rotation as it should when a new game is started. What is happening and how can I fix it?

Here’s some snippets of code to help you guys understand what is going on.

Keep in mind none of this has actual variables, it's just for the idea.


// saving the value(each value for position is saved as individual "X" "Y" and "Z"
PlayerPrefs.SetFloat(name, value);

// when loading game, making variable equal to value
variable = PlayerPrefs.SetFloat(name, value);

// Setting players position to the value

player.transform.position.x = variable;

// for rotation 

player.transform.eulerAngles.y = variable;

When you push a new build out to your Android, it deletes whatever old PlayerPrefs you have in there. If you’d play around on the android device, save it, and then load it up, you’d probably find that it loads correctly.

Or if it doesn’t load at all, then it might not correctly save or load playerprefs, perhaps because you have the location hard-coded to a point on your computer, which your Android obviously cannot find.