Convert TextMeshPro to UnityEngine.UI.Text

Hi,

I have a function which recieves a UnityEngine.UI.Text, and I want to be able to also pass on TestMeshPro objects, is it possible?

Thanks in advance.

Can you be more specific?

Are you trying to pass an object type or just access properties of both?

Pass an object type.
Here’s the function.

public static TextWriterSingle AddWriter_Static(Text uiText, string textToWrite, float timePerCharacter, bool invisibleCharacters, bool removeWriterBeforeAdd)

I have seen a tutorial on youtube which is basically the same as mine, but he could pass the TextMeshPro, while I got the exception.

The object type to pass in the case of TextMeshPro wold be <TMP_Text> which is the base class for both which is the TMP component that uses the MeshRenderer and which is the component that works with the Canvas system.