I have to find child gameObject with specified parent. Uhm. Let me explain more detail. I'm creating the prefab which have one child gameObject named 'state' and the name of parent gameObject is changed when i play the game. I mean the name of child gameObject is always same but the name of parent gameObject is all different. How can i know which child one is under specified parent one. It's not easy as i thought. This is the code below that i've tried.
go = Instantiate(Resources.Load("Prefabs/User")) as GameObject;
go.transform.FindChild("State").gameObject.name = userIndex.ToString();
go.transform.FindChild(userIndex.ToString()).gameObject.SetActive(false);
This code is not effective because the name "state" is equal to all. How can i modified more clear and effective. Please give me some idea.
For example, the created name of four prefabs are 'a','b','c', and 'd'. All gameObjects have same name of child ;'state'. All I want to know is how to find the 'state'(child gameObject) which is under 'a' (parent gameObject). I don't know much about the unity feature. How can i deal with finding the child under desired parent.