I’m trying to change the GUI’s Text but the script gives me this error
and heres my script
#pragma strict
static var currentScore : int = 0;
var GUI2 : Transform;
function OnGUI ()
{
GUI2.text = ("Score: " +currentScore);
}
I’m trying to change the GUI’s Text but the script gives me this error
and heres my script
#pragma strict
static var currentScore : int = 0;
var GUI2 : Transform;
function OnGUI ()
{
GUI2.text = ("Score: " +currentScore);
}
GUI2 is a trasform.
A transform does not have a guitext.
A game object may have a gui text.
try GUI2.gameObject.guitext.text
You can answer questions like this by yourself with a look at the API docs.
See
and