Cannot find Text component in children

I’ve got a GameObject with one child “Text” gameObject attached to it.

In one of my script I’ve got the lines :
Text textObject = gameObject.GetComponentInChildren();
Debug.Log (textObject);

The Debug line always return null.
So is it not possible to find a UI item through script?

is the child disabled? i think child must be enabled for this to work.

yes it is active

where are you calling it from? i just tried your code in Start and seems to work fine

I call it from another gameObject.

I basically have

public RectTransform UIObject;

void Start()
{
  if(UIObject != null)
  {
    Text text = UIObject.GetComponentInChildren<Text>();
    Debug.Log (text);//to check if it works
  }
}