TextMeshPro.fontSharedMaterial

Material fontSharedMaterial;

Description

The material assigned to this text object. Using fontSharedMaterial will not result in an instance of the material.


using UnityEngine;
using System.Collections;
using TMPro;

public class ExampleClass : MonoBehaviour
{
    void Awake()
    {
        TextMeshPro textmeshPro = GetComponent<TextMeshPro>();
        textmeshPro.font = Resources.Load("ARIAL SDF", typeof(TMP_FontAsset)) as TMP_FontAsset;      
        textmeshPro.fontSharedMaterial = Resources.Load("ARIAL SDF Metal", typeof(Material)) as Material;
    }    
}