Hey everybody,
I have a GUIText array with random tips that I would like displayed using Random.Range.
The random tips works fine. However, the code I am using will only display a random tip if the other GUITexts are enabled in the Hierarchy.
Code:
var tipsArray : GUIText[];
var currentTip:GUIText;
function Start () {
currentTip.enabled=false;
showRandomTip();
}
function showRandomTip() {
currentTip.enabled=true;
currentTip = tipsArray[Random.Range(0,tipsArray.length)];
currentTip.transform.position=Vector3(.5,.5,0);
currentTip.fontSize=Screen.width/20;
currentTip.enabled=true;
print("SHOW currentTip");
}
This works fine, but it only works when all the GUITexts are enabled in the Hierarchy. If I disable them, so that you cannot see them when the scene is running, No GUITexts are displayed.
Which makes sense, because they are not enabled.
I thought that currentTip.enabled=true; would fix that, but it doesn’t.
Nothing shows.
Any idea what I’m doing wrong and how to fix this?
Thanks!