Highscore and PlayerPrefs unity C#
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);
}
}
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.
What's the question/issue? Are you having issues because on line 26 it's calling a non-existent method in the StartCoroutine invocation? Is the information not saving? Whats the issue?
@landern sorry, I was just temporarily removing parts that you don't need to see, and I missed that bit. Anyway I need help with making a scoring system that saves highscore.
Well the Integer you saved can be read again with PlayerPrefs.GetInt("highscore"), other than that it would be great if you could go into further detail about what you want to achieve
Answer by mahdiii · Aug 26, 2016 at 04:37 PM
your question!!!!
I want to make a scoring system with a highscore but I can't think how to
Your answer
Follow this Question
Related Questions
Highscore system unity C# 0 Answers
How do I make a Score and Highscore thingie in game over screen 2 Answers
Game over high score script 0 Answers
Highscore Not Updating Upon Death 1 Answer