The following code is working and is basically taken from the reference. But how would I write if I wanted every child to get;" guiTexture.enabled = false;"…I tried around a bit but I only get errors
for (var child : Transform in createGUI.transform) {
child.Translate(0, 10, 0);
}
well first you have to get those components. As far as I can tell from reading this link GetComponentInChildren you can get all the active components in the children with
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Component[] hingeJoints;
void Example() {
hingeJoints = GetComponentsInChildren<HingeJoint>();
foreach (HingeJoint joint in hingeJoints) {
joint.useSpring = false;
}
}
}
Now I am unsure as to script.DoSomething() does it for all of them or not. If it does it will do it to the parent as well so I think your code would look something like this
foreach (GUITexture gt in transform.GetComponentsInChildren<GUITexture>())
{
if (gt.transform.parent != null)
{
gt.enabled = false;
}
}