Accessing children UI elements of the canvas

I want to access the children of a particular canvas in order to later manipulate them (e.g. change their position, etc.). How can I do it?

Well the canvas has transform too, doesn’t GetChild(index) do what you need?

just like any regular game object. to reference a parent’s child use gameObject.transform.FindChild (“ChildName”).gameObject if the script is on the parent of the child you are trying to reference.

Text text = can.GetComponent().Find(“InputField”).GetComponent().GetComponent().Find(“Text”).GetComponent();
//where can = a reference to your canvas component

        Debug.Log("text: " + text.text);

go through the transforms and use .Find() to insert the string name of the component THEN GETCOMPONENT< INPUTFIELD> (.Find() returns a transform so you’re doing Transform.GetComponent< InputField>) It’s long and ugly but maybe this will help you.

var canvas = GameObject.FindGameObjectWithTag(“s2_canvas”);

var carSelectionBtns = canvas.transform.GetChild(0).GetChild(0).GetChild(0).GetComponentsInChildren();

try like this

Text textget = can.transform.Find("Canvas").transform.Find("TextGameObject").GetComponent<Text>();