Hello everyone! Im here with a frustrating problem, so i have objects that have one child, i use transform.GetChild(0) to use it. It works, but not for the first object. First object firstly finds right child, but then it returns it self like a child. As a result i change the actual object not the child. I dont know why it happens only to the first object. Look on the ids in the console.
public void setEventComponent()
{
if (id == 0)
Debug.Log("ID 0: "+transform.GetChild(0));
if (id == 1)
Debug.Log("ID 1: " +transform.GetChild(0));
if (id == 2)
Debug.Log("ID 2: " + transform.GetChild(0));
eventGamobject = transform.GetChild(0);
eventImageComponent = eventGamobject.GetComponent<Image>();
}
