Search Unity

TextMesh Pro OnNewText action?

Discussion in 'UGUI & TextMesh Pro' started by FeastSC2, Nov 27, 2019.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    I would like to know when a new text is set on a TextMeshPro component. Is there a builtin way?

    I want this so that I can modify the text right before it's displayed on a separate component.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    There is an ON_TEXT_CHANGED which is called when the text object is changed. See example scene 23 - Animating Vertex Attributes and the VertexJitter.cs script. These are both included in the TMP Examples & Extras.

    This callback occurs when the text has changed and been processed whereas I think you want a callback when the string has been changed perhaps?

    At any rate see if that callback works for your needs.