I am working on a project in Unity and I'm trying to change my font size and color of my label. I keep getting a error on line 21... I think it's not reading the colon or something. How do I fix?
public class PlayerScore : MonoBehaviour
{
public int points = 0;
// Start is called before the first frame update
void Start()
{ }
// Update is called once per frame
void Update()
{ }
// score label
private void OnGUI()
{
var myFont : GUIStyle = new GUIStyle();
myFont.fontSize = 100;
GUI.color = Color.white;
GUI.Label(new Rect(10, 10, 100, 100), "Score: ", + points);
}
}
I think that you should do
var myFont : GUIStyle;
instead. After that you can modify the style in the inspector.Try to give a better read on that page on Unity manual on how to use it accordingly: https://docs.unity3d.com/Manual/class-GUIStyle.html