Hi,
I have a UI Button and have a reference to it. It has two children.
Can I reference any of them by using their parent reference?
I found what seems to be solution but it looks weird - it suggests to use transform.Find() of the parent object.
Hi,
I have a UI Button and have a reference to it. It has two children.
Can I reference any of them by using their parent reference?
I found what seems to be solution but it looks weird - it suggests to use transform.Find() of the parent object.
Transform childTransforms = parent.GetComponentsInChildren();
can use : GameObject gameObject = GameObject.FindObjectsOfTypeAll (typeof(GameObject)) as GameObject; then find by it’s name
Done it with transform. It works. But it still looks weird for me and seems laggy.
ParentObject.transform.GetChild(1).GetComponent<CanvasRenderer>()