Hello,
I’m having a problem with GUI.TextField. When I use it to create a textfield that shows how long you have been playing. It won’t update and is stuck at a fixed number.
My code is as follows:
void Update () {
m_Time += UnityEngine.Time.deltaTime;
stringToEdit = stringToEdit + m_Time.ToString();
}
void OnGUI()
{
stringToEdit = GUI.TextField(new Rect(Screen.width - 200, Screen.height - 50, Screen.width - 30, Screen.height - 30)
, stringToEdit, 25);
PlayerPrefs.SetString("", stringToEdit);
}
Also, I have to use UnityEngine.Time.deltaTime otherwise if I use Time.deltaTime, deltaTime gives the error “Time does not contain a definition for deltaTime”.
Don’t know if that’s got anything to do with it, just thought I’d mention it.