[SDK 3.6.1] Cannot access TMP_Text properties through TextMeshPro reference.
tracked
Genesis
Properties like TMP_Text.fontMaterial cannot be accessed if the object reference type is TextMeshPro even though it inherits from TMP_Text. You end up having to cast back to the TMP_Text type to use the property:
var fontRenderer1 = renderer.GetComponent<TextMeshPro>();
f(fontRenderer1 != null) fontRenderer1.fontMaterial = ...; // Throws not exposed in Udon error.
var fontRenderer2 = renderer.GetComponent<TMP_Text>(); // Can throw an error if there is no TextMeshPro component on the object
if(fontRenderer2 != null) fontRenderer2.fontMaterial = ...; // Accessible in Udon
var fontRenderer3 = (TMP_Text)renderer.GetComponent<TextMeshPro>();
f(fontRenderer3 != null) fontRenderer3.fontMaterial = ...; // Accessible in Udon
Log In
Fax
tracked