Search Unity

modifying maxVisibleCharacter resets Vertex Color.

Discussion in 'UGUI & TextMesh Pro' started by Gekigengar, Nov 2, 2018.

  1. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Hello, I am trying to create an appearing text such as seen in this.


    Where characters unfold with new sentences,
    while sentences that are already read will have 50% alpha transparency.

    But modifying maxVisibleCharacter resets the Vertex Color alpha transparency.
    Any ways to keep the Vertex coloring even after modifying the TMP_Text.maxVisibleCharacter?

    Thankyou.
     
    Last edited: Nov 2, 2018
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Any changes to properties of the text will result in a new layout / processing of the text which will reset any post modifications done to it.

    This mean, you need to keep re-applying your changes after the text gets updated.

    You could also set the public TextRenderFlags renderMode to DontRender which would skip over pushing the updated geometry to the mesh. This would retain the previous changes but you would need to make sure you only update what has changed. Might be easier to just keep on updating the whole text unless performance is key here.

    Also take a look at the VertexJitter.cs script and its use of the TMPro_EventManager.TEXT_CHANGED_EVENT which might be useful to known when you need to update your post processing of the text.