Playtime Script dont show the Gui

Hi, this script works, but does not show the gui in the game, someone knows how to fix it

using UnityEngine;
using System.Collections;

public class PlayTime : MonoBehaviour {
    public int PlayTimer = 0; // Sirve para manipular el tiempo de juego.
    public int seconds = 0;
    private int minutes = 0;
    private int hours = 0;



    // Inicializa la funcion
    void Start () {
        StartCoroutine("playTimer");
   
    }

    private IEnumerator playTimer()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            PlayTimer +=1;
            seconds = (PlayTimer % 60);
            minutes = (PlayTimer / 60) % 60;
            hours = (PlayTimer / 3600) % 24;
          
        }

    }

    void onGUI()
    {
        GUI.TextArea(new Rect(10,10, 50,20), "PlayTimer = " + hours.ToString() + " Hours " + minutes.ToString() + " Minutes " + seconds.ToString() + " Seconds ");
    }

   

}

Thanks:)

OnGUI

not

onGUI

1 Like

it’s also the “old way” of doing UI, if you aren’t really tied to the old method I’d suggest looking up the new way that came in since 4.6.

1 Like

Thanks for all the help, it was a stupid mistake, i will see more about the new UI.

misspelling the function name is probably the most common problem in the legacy gui system, I think we’ve all done it :smile: