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

Highscore and PlayerPrefs unity C#

$
0
0
So I'm not new I but never really worked around scoring with highscores and player prefs. Here is my script and help is greatly appreciated. using UnityEngine; using System.Collections; using UnityEngine.UI; public class Scoring : MonoBehaviour { public int highscore; private float waitTime = 0.25f; public Text scoreText; public Text highScoreText; public int scoreCount = 0; public bool updateScore = true; void Score() { if (highscore > scoreCount) { PlayerPrefs.SetInt("highscore", highscore); } } IEnumerator Highscore() { if (highscore < scoreCount) { highScoreText.text = "" + scoreCount; } StopCoroutine("Highscore"); yield return new WaitForSeconds(0); } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



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