Search Unity

Question How to write a script that will handle both text and TextMeshPro?

Discussion in 'UGUI & TextMesh Pro' started by makemohrgames, Dec 18, 2020.

  1. makemohrgames

    makemohrgames

    Joined:
    Dec 5, 2020
    Posts:
    1
    I have inherited some unity scripts that have [RequireComponent (typeof(Text))] and works on the old text component. I want this to work with TextMeshPro text.

    What I have been doing, is copying the whole script to a new file. Renaming the class to xxxx_TMP, and rewriting the text specific parts to use TextMeshPro.

    Is this the best way? Is there a way to have one script that can handle both?