public void DoLocalize_TMPUGUILabel(string MainTranslation, string SecondaryTranslation) { { //--[ Localize Font Object ]---------- #if TextMeshPro_Pre53 TMPro.TextMeshProFont newFont = GetSecondaryTranslatedObj(ref MainTranslation, ref SecondaryTranslation); #else TMPro.TMP_FontAsset newFont = GetSecondaryTranslatedObj(ref MainTranslation, ref SecondaryTranslation); #endif if (newFont != null) { if (mTarget_TMPUGUILabel.font != newFont) { var oldMaterial = mTarget_TMPUGUILabel.fontSharedMaterial; mTarget_TMPUGUILabel.font = newFont; var mYmat = mTarget_TMPUGUILabel.fontMaterial; CommonUtility.CopyMaterialProperties(oldMaterial, mYmat); if (oldMaterial.shaderKeywords.Contains(ShaderUtilities.Keyword_Glow)) mYmat.EnableKeyword(ShaderUtilities.Keyword_Glow); if (oldMaterial.shaderKeywords.Contains(ShaderUtilities.Keyword_Bevel)) mYmat.EnableKeyword(ShaderUtilities.Keyword_Bevel); if (oldMaterial.shaderKeywords.Contains(ShaderUtilities.Keyword_Outline)) mYmat.EnableKeyword(ShaderUtilities.Keyword_Outline); if (oldMaterial.shaderKeywords.Contains(ShaderUtilities.Keyword_Underlay)) mYmat.EnableKeyword(ShaderUtilities.Keyword_Underlay); mTarget_TMPUGUILabel.fontMaterial = mYmat; mTarget_TMPUGUILabel.UpdateMeshPadding(); } } (.....) --------------- public static void CopyMaterialProperties(Material source, Material destination) { MaterialProperty[] sourceProperties = MaterialEditor.GetMaterialProperties(new Material[] { source }); for (int i = 0; i < sourceProperties.Length; i++) { int propId = Shader.PropertyToID(sourceProperties[i].name); if (destination.HasProperty(propId)) { switch (ShaderUtil.GetPropertyType(source.shader, i)) { case ShaderUtil.ShaderPropertyType.Float: destination.SetFloat(propId, source.GetFloat(propId)); break; case ShaderUtil.ShaderPropertyType.Range: destination.SetFloat(propId, source.GetFloat(propId)); break; case ShaderUtil.ShaderPropertyType.Vector: destination.SetVector(propId, source.GetVector(propId)); break; case ShaderUtil.ShaderPropertyType.Color: destination.SetColor(propId, source.GetColor(propId)); break; } } } }