Search Unity

TextMesh Pro Change current material index

Discussion in 'UGUI & TextMesh Pro' started by CoolJosh3k, Feb 14, 2023.

  1. CoolJosh3k

    CoolJosh3k

    Joined:
    Dec 3, 2016
    Posts:
    145
    I have a list of materials that I can choose for the font in an objects inspector, but I need to change which one it uses programmatically.

    However, TMP_Text.m_currentMaterialIndex is inaccessible due to its protection level. I don't immediately see anyway to set this with a method or to replace with a modified instance clone.
     
  2. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    CoolJosh3k likes this.
  3. CoolJosh3k

    CoolJosh3k

    Joined:
    Dec 3, 2016
    Posts:
    145
    flashframe likes this.