whats wrong? when im save position and try load script changing my position wrong…
SCRIPT:
function OnGUI() {
if(paused) /// if escaped pressed display menu
{ manager = GameObject.FindGameObjectWithTag("Player").GetComponent(GUIManager);
GameObject.FindGameObjectWithTag("Player");
if (GUI.Button(Rect(10,10,50,50),save))
{
PlayerPrefs.GetFloat.Vector3(newXpos, newYpos, newZpos, transform.position);
PlayerPrefs.SetInt("currentHealth", manager.currentHealth);
;
}
}
if(paused) /// if escaped pressed display menu
{ manager = GameObject.FindGameObjectWithTag("Player").GetComponent(GUIManager);
GameObject.FindGameObjectWithTag("Player");
if (GUI.Button(new Rect(35,35,100,50),load))
{
manager.currentHealth = PlayerPrefs.GetInt("currentHealth");
var newXpos : float = PlayerPrefs.GetFloat("PlayerX");
var newYpos : float = PlayerPrefs.GetFloat("PlayerY");
var newZpos : float = PlayerPrefs.GetFloat("PlayerZ");
transform.position = Vector3(newXpos, newYpos, newZpos);
}
}