Skip to content
Adam Graham edited this page Nov 13, 2023 · 6 revisions

Links

FAQs


Is the source project free to use?

Yes, you are free to use the project for any purpose. However, keep in mind that copyright and/or trademark laws can still apply to the original material since many of the games in my tutorials were not originally authored by me. I open source my own code for the community to learn from, but the project is intended for educational purposes only.


How do I save hiscores?

Using Unity's PlayerPrefs is an easy way to save a hiscore to the local system. When we update the score in the GameManager.cs script, we can also update the hiscore if its been beaten:

public void IncreaseScore(int points)
{
    score += points;
    scoreText.text = score.ToString();

    float hiscore = PlayerPrefs.GetFloat("hiscore", 0);

    if (score > hiscore)
    {
        hiscore = score;
        PlayerPrefs.SetFloat("hiscore", hiscore);
    }
}
Clone this wiki locally