Help with score script.

I made a script to show your score in the top left corner of your screen but when I attach it to the camera I can’t see anything.
Any ideas?

Post the code.

using UnityEngine;
using System.Collections;

public class HUDScript : MonoBehaviour {

    float playerScore = 0;

    void Update () {
        playerScore += Time.deltaTime;
    }

    public void IncreaseScore(int amount)
    {
        playerScore += amount;
    }

    void onGUI()
    {
        GUI.Label (new Rect (10, 10, 100, 30), "Score: " + (int)(playerScore * 100));
    }
}

onGUI() pops out immediately. It should be OnGUI() with a capital ‘O’.

1 Like

Thanks got it fixed.