public static Material GetStencilMaterial(Material baseMaterial, int stencilID)
        {
            if (!baseMaterial.HasProperty(ShaderUtilities.ID_StencilID))
            {
                Debug.LogWarning("Selected Shader does not support Stencil Masking. Please select the Distance Field or Mobile Distance Field Shader.");
                return(baseMaterial);
            }
            int instanceID = baseMaterial.GetInstanceID();

            for (int i = 0; i < TMP_MaterialManager.m_materialList.Count; i++)
            {
                if (TMP_MaterialManager.m_materialList[i].baseMaterial.GetInstanceID() == instanceID && TMP_MaterialManager.m_materialList[i].stencilID == stencilID)
                {
                    TMP_MaterialManager.m_materialList[i].count++;
                    return(TMP_MaterialManager.m_materialList[i].stencilMaterial);
                }
            }
            Material material = new Material(baseMaterial);

            material.hideFlags      = HideFlags.HideAndDontSave;
            material.shaderKeywords = baseMaterial.shaderKeywords;
            ShaderUtilities.GetShaderPropertyIDs();
            material.SetFloat(ShaderUtilities.ID_StencilID, (float)stencilID);
            material.SetFloat(ShaderUtilities.ID_StencilComp, 4f);
            TMP_MaterialManager.MaskingMaterial maskingMaterial = new TMP_MaterialManager.MaskingMaterial();
            maskingMaterial.baseMaterial    = baseMaterial;
            maskingMaterial.stencilMaterial = material;
            maskingMaterial.stencilID       = stencilID;
            maskingMaterial.count           = 1;
            TMP_MaterialManager.m_materialList.Add(maskingMaterial);
            return(material);
        }
        public static void AddMaskingMaterial(Material baseMaterial, Material stencilMaterial, int stencilID)
        {
            int num = TMP_MaterialManager.m_materialList.FindIndex((TMP_MaterialManager.MaskingMaterial item) => item.stencilMaterial == stencilMaterial);

            if (num == -1)
            {
                TMP_MaterialManager.MaskingMaterial maskingMaterial = new TMP_MaterialManager.MaskingMaterial();
                maskingMaterial.baseMaterial    = baseMaterial;
                maskingMaterial.stencilMaterial = stencilMaterial;
                maskingMaterial.stencilID       = stencilID;
                maskingMaterial.count           = 1;
                TMP_MaterialManager.m_materialList.Add(maskingMaterial);
            }
            else
            {
                stencilMaterial = TMP_MaterialManager.m_materialList[num].stencilMaterial;
                TMP_MaterialManager.m_materialList[num].count++;
            }
        }