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

saving a text into a player pref

$
0
0
hello everyone. i am having a issue saving a text into a player pref. i am making a character selection, i am using Unity ads, when an ad finish, the user will obtain a point and i want that these points get save in a player pref, but it doesn't save the text. in one script i have private int stressedPoint; public Text texto; void Start() { PlayerPrefs.GetInt("points").ToString(); } void points() { Points.scoreValue += 1; } public void OnUnityAdsDidFinish(string placementId, ShowResult showResult) { switch (showResult) { case ShowResult.Failed: break; case ShowResult.Finished: if (placementId == rewardedVideoAd) { points(); PlayerPrefs.SetInt("points", stressedPoint); } break; } } } in another script i have public static int scoreValue = 0; Text points; // Start is called before the first frame update void Start() { points = GetComponent(); } // Update is called once per frame void Update() { points.text = "Points: " + scoreValue; } public void adPoints() { Points.scoreValue += 1; }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



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