Activating / Deactivating GameObject with childs

Hello *,

I have made a menue and now I want to enable / disable the pages.

For this I have createe e.g. 3 empty GameObjects (named menu01 … menu03). Every GameObject contains several 3D Text etc.

The main Scripts which is attached to the camera has an array menuPage: GameObjects[ ];

In the inspector I have droppen:

menu00 into menuPage[0],
menu01 into menuPage[1],
etc.

Now, when the page should change I’d like to use:

menuPage[iMenu].active = false;
menuPage[iNewMenu].active = true;
iMenu = iNewMenu;

but this won’t work.

Please can you tell me how to activate / deactivate a GameObject with all childs?

Thank you very much,
Ulrich

have you tried gameObject.SetActiveRecursively(true); Here is more info on it… http://unity3d.com/support/documentation/ScriptReference/GameObject.SetActiveRecursively.html I use it for GUI windows with several children including buttons and scoll lists ect.

Hi zergcow,

thank you very much. This is exactly what I wanted to know. :slight_smile:

Ulrich