Hey all, I have had a look around and can not find a perfewct answer to my question. I am playing around with Unity again and think it is an amazing Game Engine. I am having a go at it with Javascript, I know C# but want to test my Javascript which is a little shoddy compared to other languages.
Anyhow, I want to use this script which I found when trying to find out an answer to my problem. However it is not updating the GUI at all! It just does nothing. I am using the standard controller which is included in the 2D tutorial.
var stringToEdit = "Player1";
var userHasHitOk : boolean = false;
function Update() {
if(Input.GetKeyDown("enter")) { userHasHitOk = true; }
}
function OnGUI () {
if (userHasHitOk)
{
GUI.Label (Rect (10, 10, 100, 30), "Hello " + stringToEdit);
}
else
{
GUI.Label (Rect (10, 10, 100, 30), "Enter Name:");
stringToEdit = GUI.TextField (Rect (90, 10, 200, 25), stringToEdit, 40);
}
}
This code is in the CameraFocus.js file but it just does not update at all. It displays the GUI but no update.
Hope someone can help,
Thank you
Well, if it displays at all that means it's updating! In what way isn't it working? EDIT: Oh I see. Just a sec...
– syclamothYeah I worked that out. Answer up now!
– syclamoth