Im trying to parse my hierarchy and find 3 different labels with a text component on each of them:
labelText = buttonObject.transform.FindChild("Firstname").GetComponent<Text>();
labelText.text = userContactsArray[0]*;*
labelText = buttonObject.transform.FindChild(“Lastname”).GetComponent();
labelText.text = userContactsArray[1];
labelText = buttonObject.transform.FindChild(“Description”).GetComponent();
labelText.text = userContactsArray[2];
But I get error “NullReferenceException: Object reference not set to an instance of an object” as if it does not find the object at all.
Is there difference with RectTransform and transform or why exactly I can not find the object? I tried something like RecTransform.FindChild but without luck. Also in documentation it was saying like (RectTransform)transform.FindChild but it didnt work either.
Thanks in advance