Skip to main content
added 180 characters in body
Source Link

The array is of type Text, which is the type of a component, but you're trying to drag an object which contains the Text component, which is of type GameObject. Make your array of type GameObject[] and then use GetComponent or GetComponentsInChildren on the stored objects to get to the text itself.

EDIT: given the new info, I've included the import and type of the array you need:

using TMPro;

and then define the array as:

public TextMeshProUGUI[] texts;

The array is of type Text, which is the type of a component, but you're trying to drag an object which contains the Text component, which is of type GameObject. Make your array of type GameObject[] and then use GetComponent or GetComponentsInChildren on the stored objects to get to the text itself.

The array is of type Text, which is the type of a component, but you're trying to drag an object which contains the Text component, which is of type GameObject. Make your array of type GameObject[] and then use GetComponent or GetComponentsInChildren on the stored objects to get to the text itself.

EDIT: given the new info, I've included the import and type of the array you need:

using TMPro;

and then define the array as:

public TextMeshProUGUI[] texts;
Source Link

The array is of type Text, which is the type of a component, but you're trying to drag an object which contains the Text component, which is of type GameObject. Make your array of type GameObject[] and then use GetComponent or GetComponentsInChildren on the stored objects to get to the text itself.