I know this has been answered before but I have tried everything that other answers have given for the past few days without any success. I’m hoping someone can explain my fundamental misunderstanding behind this.
Here is the current iteration of my script. I’ve clicked and dragged a script into the Globals variable and I’ve clicked and dragged a button in to the ThisButton variable. The rest is obvious. I don’t think I need the import UnityEngine.UI; but I’ve tried without it as well.
#pragma strict
import UnityEngine.UI;
var Globals : GlobalValues;
var ThisButton : UnityEngine.UI.Button;
var CrewMember = 0;
function Start () {
}
function Update () {
if (Globals.Crew1[0] == 1){
ThisButton.GetComponentsInChildren.<Text>.text = "testing";
}
}
Right now the error is that ‘UnityEngine.Component.GetComponentsInChildren’ is not a generic definition. But there have been plenty of other errors on other tries.
Basically, if my if statement is true, how do I change the text of my button? Thanks for any help on this.