# How to programmatically activate the Glow option in a Text Mesh Pro font

I can activate the Glow setting for a Font in Text Mesh Pro by checking the Glow checkbox:

Is there a way I can programmatically do the same thing? I looked in the corresponding shader, and found what I think is the name of the variable: GLOW_ON. But when I tried to set that variable to 1 using Material Set Float and Set Int, neither one worked. Either I have the wrong variable name, or I'm not setting it the proper way.

Any suggestions on how to programmatically activate the Glow option in a Text Mesh Pro font?

• Also just tried Set Integer, but that didn't work either. Aug 10 at 18:55
• Aug 10 at 19:59

This is a shader variant using #pragma shader_feature, See SL-MultipleProgramVariants.

"TextMeshPro/Mobile/Distance Field":

#pragma shader_feature __ GLOW_ON
...
#ifdef GLOW_ON
...
#endif


So use Material.EnableKeyword(and DisableKeyword) in C# code:

material.EnableKeyword("GLOW_ON");
material.DisableKeyword("GLOW_ON");


And,

The version of this function that takes a string as a parameter is slower than the version that takes a LocalKeyword. If you call this function more than once, it is best practice to create a LocalKeyword struct, cache it, and use that.

• Instead of typing out the string, you can also get it from TMPro.ShaderUtilities.Keyword_Glow Aug 10 at 19:57
• Wow this worked perfectly. Thank you!! Aug 11 at 1:50