This question was
closed Apr 11, 2016 at 07:30 PM by
TylerStudios for the following reason:
Other
Question by
TylerStudios · Apr 09, 2016 at 08:37 PM ·
c#scripting problemhighscores
Leaderboard Unity [C#] Help
Here is Leaderboard code but it isnt updating please help
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LeaderBoard : MonoBehaviour
{
public int highScoreEz;
public int highScoreMed;
public int highScoreHard;
string highScoreKeyEz = "0";
string highScoreKeyMed = "0";
string highScoreKeyHard = "0";
public Text hSEz;
public Text hSMed;
public Text hSHard;
void Start()
{
highScoreEz = PlayerPrefs.GetInt(highScoreKeyEz, 0);
highScoreMed = PlayerPrefs.GetInt(highScoreKeyMed, 0);
highScoreHard = PlayerPrefs.GetInt(highScoreKeyHard, 0);
}
void Update()
{
hSEz.text = "" + highScoreEz;
hSMed.text = "" + highScoreMed;
hSHard.text = "" + highScoreHard;
}
}
Comment
Answer by JigneshKoradiya · Apr 09, 2016 at 08:44 PM
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LeaderBoard : MonoBehaviour
{
public int highScoreEz;
public int highScoreMed;
public int highScoreHard;
string highScoreKeyEz = "0";
string highScoreKeyMed = "0";
string highScoreKeyHard = "0";
public Text hSEz;
public Text hSMed;
public Text hSHard;
void Start()
{
}
void Update()
{
highScoreEz = PlayerPrefs.GetInt(highScoreKeyEz, 0);
highScoreMed = PlayerPrefs.GetInt(highScoreKeyMed, 0);
highScoreHard = PlayerPrefs.GetInt(highScoreKeyHard, 0);
hSEz.text = "" + highScoreEz;
hSMed.text = "" + highScoreMed;
hSHard.text = "" + highScoreHard;
}
}
Follow this Question
Related Questions
Highscore - BestTime 1 Answer
Help with high score SQL table and the C# scripts 0 Answers
Continuously monitor childrens properties 1 Answer
How would i modify my current script to remove these UI buttons without killing my pause menu? 1 Answer
Why does NetworkServer.ReplacePlayerForConnection not recognize the instantiated object parameter? 0 Answers