Hi guys, I'm wondering why am I getting this error at line 26? If I take off the "myText.enabled = false;" part then it works. But I want the text to disappear if the GameObject's Y rotation is between 270 and 0 or between 0 and 90.
var moveSpeed = 50;
private var yRotation = 0;
function Update () {
var z = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate(0, 0, z);
if (Input.GetAxis("Horizontal"))
{
yRotation += Input.GetAxis("Horizontal") * 2;
transform.eulerAngles = Vector3(0, yRotation, 0);
if (transform.eulerAngles.y > 90 && transform.eulerAngles.y < 270)
{
var myText : GUIText = gameObject.Find ("Wrong Way").GetComponent ("GUIText");
myText.enabled = true;
}
if (transform.rotation.y < 90 || transform.rotation.y > 270)
{
myText.enabled = false;
}
}
}