Get Children of Child and Deactivate/Activate on Demand

So here is my layout, I have a 3D Menu system working and they are all in a parent/ child relationship. So for example I have my GuiRoot variable which is just an empty game object then the child of that GuiRoot is going to be my MainMenu. I then have children inside of MainMenu each child has a bunch of siblings as well so it looks kind of like this:

alt text

So when i need to transition to my next menu my camera is promted to tween to the CameraLookAt and CameraPosition. I then get the name of the Parent of the currentMoveToPosition and compare my childs name with that name which should be MainMenu( and it is) but i then need to get all of the children of MainMenu and activate them which is what i am trying with the second for each.

My Problem is that the second for each isn’t firing and I do not understand why not. The Print(“in grouping”); never gets sent and so neither does the if below. The Printing of the and DOES however fire. and everything inside of gui gets turned off… I dont understand the issue with my code.

This is all a bit complicated and I don’t know if i explained it very well. So if you need more explanation I can expand.

allGuiChildren = guiRoot.GetComponentsInChildren<Transform>();
		// Turn off all GUI cases except for the Main Menu
		foreach( Transform guiChild in allGuiChildren )
			print(" in gui children");
			// get the parent of the current move to target in this case it is main menu
			if( ==
				Transform[] currentGuiGrouping;
				currentGuiGrouping = guiChild.GetComponentsInChildren<Transform>();
				print(" in current Move to target" + currentGuiGrouping);

				foreach( Transform guiGroupingChild in currentGuiGrouping)
					print("in grouping");
					if( == "GuiBase"){
				print( + " " +;
				// figure out how to set the children of mainmenu true

Thanks in advance!



to find the transforms of inactive objects, too.

Also, you can iterate over a transform itself. So you can do this instead:

// Turn off all GUI cases except for the Main Menu
foreach( Transform guiChild in guiRoot.transform ) {...}


foreach( Transform guiGroupingChild in guiChild.transform ) {...}

Makes the code simpler.