FANDOM


AC's Menu system can be used in conjunction with other Unity UI assets, such as Text Mesh Pro.  This integration works by copying the values from a Unity UI textbox, and pasting them in a Text Mesh Pro UGUI component.  This script can be modified to work with other such UI assets.

  1. Make sure that both AC and Text Mesh Pro are installed
  2. Prepare your Menu by changing its Source to Unity Ui Prefab, and linking it to a Unity UI canvas prefab (see AC's Manual or this tutorial).
  3. Each label you want to replace with TMPro will need both a Unity UI Text component, and a Text Mesh Pro UGUI component.  The Text component can be hidden or given an invisible colour, but should not be disabled.
  4. Create a new C# script named TextMeshPro_AC.cs, and overwrite its contents with the code below.
  5. Drag your UI prefab into the scene
  6. Add the script to each Text component, and add itself to the "Text To Copy From" field, and add its associated Text Mesh Pro UGUI to the "Text Mesh To Copy To" field.
  7. Apply the changes to the prefab, and remove
using UnityEngine;
using System.Collections;
using AC;
using UnityEngine.UI;
using TMPro;

public class TextMeshPro_AC : MonoBehaviour
{

    public Text textToCopyFrom;
    public TextMeshProUGUI textMeshToCopyTo;


    private void Update ()
    {
        textMeshToCopyTo.text = textToCopyFrom.text;
    }

}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.