Forum rules - please read before posting.

Linking AC's menu label with TextMeshPro Text?

I switched to TextMeshPro because the customization and quality was overall better than Unity's standard Text.

I noticed that I couldn't drag/link the TextMeshPro Text with the label properties for the AC menu since it only takes the Unity Text UI.

I have followed a guide from: https://adventure-creator.fandom.com/wiki/Text_Mesh_Pro_integration
and its basically creating one Unity UI Text and one Text Mesh Pro Text and then simply hiding the Unity Text (either positioning it somewhere offscreen or setting alpha to 0) then linking that Unity Text with the AC menu's properties.

I then created a script as the guide suggested and attached it to the TextMeshPro Text and did referencing so it takes the Unity's Text value and sets TextMeshPro's Text.

public class TextMeshPro_AC : MonoBehaviour
{
    public Text textToCopyFrom;

    public TextMeshProUGUI textMeshToCopyTo;


    private void Update()

    {

        textMeshToCopyTo.text = textToCopyFrom.text;

    }
} 

Now this works all fine and all but is this a good way of doing it or is there a better way of doing something like this?

Comments

  • See the note at the top of the wiki page - AC's TextMeshPro integration is now built in, there's no longer a need to rely on a separate script.

    You'll first have to tell AC that it's "safe" to run its TextMeshPro-related code. You can do this by going to Unity's Player settings and adding "TextMeshProIsPresent" (no quotes) to the Scripting Define Symbols box.

    You should then find that, rather than accepting Unity UI Text components, the Menu Manager now references TextMeshProUGUI components. You'll have to be consistent with your menus - it's either UI Text or TMPro, but if you replace your Text components you should then find that AC will rely on TMPro from then on.

  • oh thanks so only stick to one gotcha.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.