- Home /
How can I make the score counter use the custom font?
I have been trying to use a custom font on a score counter and I keep getting errors when I try to call yourFont.
using UnityEngine; using System.Collections;
public class HudScript : MonoBehaviour {
public Font yourFont;
float playerScore = 0;
void Update ()
{
playerScore += Time.deltaTime;
}
public void IncreaseScore(int amount)
{
playerScore += amount;
}
void OnDisable()
{
PlayerPrefs.SetInt ("Score", (int)(playerScore * 100, yourFont));
}
void OnGUI()
{
GUI.Label (new Rect (10, 10, 100, 30), "Score: " + (int)(playerScore * 100));
}
}
Comment
"keep getting errors"... it would help us help you if you told us what those errors were rather than having to guess.... but this line makes no sense:
PlayerPrefs.SetInt ("Score", (int)(playerScore * 100, yourFont));
What's the yourFont doing there?
Your answer
![](https://koobas.hobune.stream/wayback/20220613164011im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I want make a box colleder for top, botton left and roght in c# but dont work 0 Answers
Make a custom score counter in unity with c# 1 Answer
Why Scene view don't show anything but game view is ok with NGUI ? 1 Answer
How can I make my creature change a direction? 0 Answers
Distribute terrain in zones 3 Answers