Hi Guys,
Trying to get a load of children (GUITexture’s and GUIText’s) to go invisible at the start of play. It’s not working.
void Start()
{
SetMenuInvisible();
}
void SetMenuInvisible()
{
pauseMenu.guiTexture.renderer.enabled = false;
foreach (Transform child in pauseMenu.transform)
{
if(child.GetComponent<GUITexture>() != null)
{
child.GetComponent<GUITexture>().renderer.enabled = false;
}
if(child.GetComponent<GUIText>() != null)
{
child.GetComponent<GUIText>().renderer.enabled = false;
}
}
The actual foreach loop works okay, I’ve checked that. However the objects don’t go invisible. There are no errors in the console. I’ve tried child.gameObject.renderer and child.renderer… Nothing seems to work, although the objects are being referenced okay.
The issues slowly giving me tourettes, please help!
Thanks