Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

PlayerPrefs not working with android

$
0
0
![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

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>