![alt text][1]in my simple Game when i try to set the high score it works in unity editor and windows build but not in android build
#pragma strict
public var scoreTxt :GameObject ;
public var bestScoreTxt :GameObject ;
var currentBestScore ;
function Start () {
bestScoreTxt.GetComponent.().text = PlayerPrefs.GetString("Best",scoreTxt.GetComponent.().text) ;
var target : motoScript = GetComponent (motoScript) ;
bestScoreTxt.GetComponent.().text = PlayerPrefs.GetString("Best");
if(float.Parse(scoreTxt.GetComponent.().text) >=float.Parse(bestScoreTxt.GetComponent.().text)){
bestScoreTxt.GetComponent.().text = scoreTxt.GetComponent.().text ;
PlayerPrefs.SetString("Best" ,bestScoreTxt.GetComponent.().text ) ;
}
}
[1]: /storage/temp/97403-screenshot-2017-07-09-16-07-22.png
↧