Search Unity

_MaskWipeControl inaccessible to script for meshrenderer version of TMP

Discussion in 'UGUI & TextMesh Pro' started by MikaMobile, May 19, 2019.

  1. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    Hi, is there a reason I can't get/set the material property "_MaskWipeControl" via script if I'm not using the UGUI version of TMP? If I switch the material to the "mobile/distance field - masking", it functions as expected and I can drag the wipecontrol slider in the inspector and see the desired results, but again, I can't get/set the float via script.

    Edit: seems to also apply to _MaskTex, can't set it either.
     
    Last edited: May 19, 2019
  2. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    Figured it out myself, I was trying to use myTextMesh.materialForRendering.SetFloat("_MaskWipeControl", someValue), which does work for the UGUI version. However, for a meshRenderer TMP you'd need to use myTextMesh.fontMaterial.SetFloat()
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Be mindful that using fontMaterial will result in the creation of a material instance whereas using fontSharedMaterial will give you the persistent material from the font asset or material preset which may be shared by multiple text objects.

    Most likely you do want the fontMaterial / instance since you are playing with masking.