Heloo help me please

Hi why does not work this script on android?
on computer is working
please help me, I’m a beginner

When you click to load so loaded at position 0,0,0

private var PlayerX : float;

private var PlayerY : float;

private var PlayerZ : float;

var PlayerPosition : Transform;

var player : GameObject;

var textureSave : Texture2D;
var textureLoad : Texture2D;

function Update(){

//=======Setting Player position for save====

PlayerX =(PlayerPosition.transform.position.x);
PlayerY =(PlayerPosition.transform.position.y);
PlayerZ =(PlayerPosition.transform.position.z);
}

//saving playerPrefs

function saveAttributes() {

PlayerPrefs.SetFloat(“PlayerX”,PlayerX);
PlayerPrefs.SetFloat(“PlayerY”,PlayerY);
PlayerPrefs.SetFloat(“PlayerZ”,PlayerZ);
}

function loadstuff () {
PlayerPosition.transform.position.x = (PlayerPrefs.GetFloat(“PlayerX”,PlayerX));

PlayerPosition.transform.position.y = (PlayerPrefs.GetFloat(“PlayerY”,PlayerY));

PlayerPosition.transform.position.z = (PlayerPrefs.GetFloat(“PlayerZ”,PlayerZ));

}
function OnGUI () {

GUI.skin.button = new GUIStyle();
if (GUI.Button(Rect(Screen.width -410, 300, 400,150), textureSave)){ //if you press ‘q’
saveAttributes();
Debug.Log(“save”);

}

GUI.skin.button = new GUIStyle();
if (GUI.Button(Rect(Screen.width -410, 500, 400,150), textureLoad)){ //if you press ‘q’
Application.LoadLevel(“Level1”);
Debug.Log(“load”);
}}

function OnLevelWasLoaded(){
loadstuff ();
}

“It doesn’t work” isn’t a satisfactory explanation. In what way doesn’t it work? Then we can try and debug it for you.

player is loaded always on position x 0, y 0 ,z 0 also when is saved elsewhere

but on computer everything works

sorry me english is weak

Explain in your native language why it fails, and explain underneath, as best you can, in English, the same thing. We can help you out, if you give us some hints.

Use verbose topic titles. I would have helped if it did.

Hi on the computer the script works as it should : I Run the game the Player is at a certain place, and when I save the game elsewhere save button so the Player is saved to a new position . When the game načítam button load so I načita game Level 1 and player is loaded to a new location

When I will create a game for android APK I install the game on your mobile and I run it like this Player is not on a designated position but at a position X = 0 Y = 0 Z = 0keď Player I save elsewhere click the save and I press the button load so the Player is loaded at the position X = 0 Y = 0 Z = 0 ,and not on the position of the kďe me a player to be retrieved

Sorry this I translated the program

Sorry I do not know where is the verbose topic

This code works perfectly fine for me on both Android and Windows.

#pragma strict

public var player : Transform;

function OnLevelWasLoaded()
{
    restorePlayerPosition();
}

function savePlayerPosition()
{
    var currentPos = player.transform.position;
    PlayerPrefs.SetFloat("PlayerX",currentPos.x);
    PlayerPrefs.SetFloat("PlayerY",currentPos.y);
    PlayerPrefs.SetFloat("PlayerZ",currentPos.z);
}

function restorePlayerPosition()
{
    var restorePos = new Vector3(PlayerPrefs.GetFloat("PlayerX"), PlayerPrefs.GetFloat("PlayerY"), PlayerPrefs.GetFloat("PlayerZ"));
    player.transform.position = restorePos;
}

function randomPosition()
{
    var randomPos = new Vector3(Random.Range(-10,10), Random.Range(0,10), Random.Range(-10,10));
    player.transform.position = randomPos;
}

function OnGUI()
{
    if (GUI.Button(Rect(Screen.width -410, 100, 400,150), "RESTORE POSITION"))
    {
        restorePlayerPosition();
    }

    if (GUI.Button(Rect(Screen.width -410, 300, 400,150), "SAVE POSITION"))
    {
        savePlayerPosition();
    }

    if (GUI.Button(Rect(Screen.width -410, 500, 400,150), "NEXT LEVEL"))
    {
        Application.LoadLevel("Level1");
    }

    if (GUI.Button(Rect(Screen.width -410, 700, 400,150), "RANDOM POSITION"))
    {
        randomPosition();
    }

}

thanks but I have a new problem when I install a new version of Unity so I can not start a new script

writes me an error:

The file ‘C:\Documents and Settings\branek42\Dokumenty\Tunnels in Dubnica\Assets\New Folder\NewBehaviourScript.js’ could not be opened. Inicializační metoda typu Boo.Lang.Compiler.TypeSystem.Types vyvolala výjimku.

When posting here, you should translate the messages to the english:
The type initializer for ‘Boo.Lang.Compiler.TypeSystem.Types’ threw an exception.
You should also post the whole error string with stack trace if possible.

Anyway, see I can't open boo or js scripts in Monodevelop with a default install? - Questions & Answers - Unity Discussions

Hi I had to install Unity 4.5.4

Thanks my script and yours script already working , error was Unity program

Thank you so much for your help