This is a Texmesh Pro noob question and might be more of a confirmation check.
I’ve added a Textmesh Pro component to a GameObject in script. (The same type that is added with: GameObject->3D Object->TextMeshPro Text)
Then, I modified certain properties (still in script). Most changes did show up but the outline didn’t. More specifically, I was able to set the outline color and thickness, but the “Enable → [ ]” checkbox to the right of “Outline -Settings-” was still unchecked.
As I tried a few things, it seems like that checkbox setting is related to the font material.
So, similarly to “regular” materials, if I create a first in the Unity Editor with the desired settings (e.g. enable outline) then the scripts can change the other properties, right?
In that case, for now it seems like that it is easier to create and set up different font materials in the Editor and just change certain properties (e.g. font size) as needed. But later on there probably will be situations where I will cases that require turning on and off certain shader keyword based features.
Unless you need to dynamically change the visual appearance of the material (which can be even done with the Animation component in Unity), it is best to use Material Presets. See the following video about Material Presets.
The intro of this video shows a good example of animating material properties using the Animation component in Unity.
There are a few threads on the forum about this topic. Having said that the procedure is as follows:
First keep in mind that the outline is just a material property where as such, any of the material properties can be changed via the material API and as per this example . In this case, the Face Dilation is being changed but the process is identical for changing any other material properties.
The next piece that is important to keep in mind is that some of the material properties are controlled by shader keywords which must be enabled which can also be done via code. The following post contains code snippets also related to this.