Highscore - BestTime
Hello together!
First of all, i am not a programmer so this code might look a bit funny. Basically what i'm trying to do is a best Time board. I have set up a text UI and attached this C# script to it. I wish to have a code where the best Time of the Player always overwrites his last worser time. If possible: i would also like to delete the saved time's with a simple keydown. So that the Player always can restart his time if he wants to.
I am really frustrated because i didn't find any other documentations on how to do a simple and proper highscore board. So i hope that somebody here could help me :). I am also open for new or other ideas.
Thank's for the effort!
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class erste : MonoBehaviour {
public float zeit;
public float zwischenzeit= 19.0f; // by default
private string topname;
public Text TotalEins; // UI Text
// Use this for initialization
void Start () {
zeit = PlayerPrefs.GetFloat ("Time"); // get saved Time
zwischenzeit = zeit;
ErstePlatz ();
}
void ErstePlatz () {
for (zwischenzeit = PlayerPrefs.GetFloat("erster"); zwischenzeit > zeit; zwischenzeit--) {
PlayerPrefs.SetFloat ("erster", zwischenzeit);
topname = PlayerPrefs.GetString ("Name").ToString ();
TotalEins.text = "Name: " + topname + " " + "Time: " + zwischenzeit.ToString ();
}
}
}
Answer by Worms123 · Aug 06, 2016 at 03:54 PM
I found a solution. AssetStore ---> SumScore
Your answer
Follow this Question
Related Questions
UI buttons won't recognize script 0 Answers
Is there a way I can make one script for all my buttons in my game? 1 Answer
A way to move "Highscore" Text to Game Over Screen? 1 Answer
Help with high score SQL table and the C# scripts 0 Answers
How do i change a color of an individual alphabet of a UI.Text 2 Answers