GameObject first = GameObject.Find(ObjName+“-parent”);
i have lot of chidren for a gameobject first . how to get first child in C#
GameObject first = GameObject.Find(ObjName+“-parent”);
i have lot of chidren for a gameobject first . how to get first child in C#
Transform firstChild = GameObject.Find(“obj1”).transform.GetChild(0);
This is the answer ThinkyHead_ gave in a comment but I’m putting it in a proper answer, because I don’t want people to miss it.
This is super old, but the question was how to get the first GameObject, so the right answer should be GameObject first = gameObject.transform.GetChild(0).gameObject;
Transform t = GameObject.Find(“obj1”).GetComponentsInChildren();
Transform theParent = t[0];
Transform firstChild = t[1];
This should work.