- Home /
Question by
daviddickball · May 26, 2014 at 05:54 PM ·
guigui-text
Can I hide a group of GUI Text objects?
I have created a empty GameObject to contain GUI Text objects, how can I make them all hidden? I can hide them all individually of course using: gameObject.Find("LevelCompleteText").guiText.enabled = true;
...but it's time consuming doing this for each one individualy. Surely there's a way to deactivate the parent group?
Comment
Best Answer
Answer by zharik86 · May 26, 2014 at 06:45 PM
For game object using function setActive(), but remember what if game object isActive=false, then you take null referense for function gameObject.Find("LevelCompleteText"). Just create you reference for object.For example(write on CSharp):
private GameObject objWithText = null;
void Start() {
//find your contener for text
objWithText = GameObject.Find("LevelCompleteText");
}
//activate your object
public void activeText() {
objWithText.SetActive(true);
}
//de-activate your object
public void activeText() {
objWithText.SetActive(false);
}