Search Unity

TextMesh Pro FaceColor not updating Submesh

Discussion in 'UGUI & TextMesh Pro' started by MrMatthias, Mar 6, 2018.

  1. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    i animate the faceColor of a text label programmatically, but the color of the submesh doesn't change. Doing this in the inspector works.

    I tried havePropertiesChanged and SetMaterialDirty with no success.
     
  2. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    Solved:
    Code (CSharp):
    1. text.color = value;
    2. text.havePropertiesChanged = true;
     
    lucassivolella likes this.
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I will still look into this as changes the text color property should be reflected on the entire text object.
     
  4. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    setting the color property changes the submeshes correctly, setting faceColor didn't work.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The TMP_Text.color property affects the vertex color which is unique to each text object.

    The TMP_Text.faceColor alters the face color of the material and in this process creates an instance of the material.

    That makes sense given the sub text object is using a different material and likely an oversight on my part :)

    I'll try to fix that as soon as I have a chance.
     
    Last edited: Mar 7, 2018