update font material for multiple text boxes in scene or project

I’m using textmesh pro and have 2 main font materials (for headings and content). If the designer changes the heading font, is there an easy way to change all the heading text boxes to reference the new font material?
I guess I could write an editor script to do it but it feels like an issue that others would have come across already so I was wondering if there was an existing solution?

Thanks

There are several ways to potentially handle this. I think the simplest might be to use the recently added Text Style feature shown in the image below where you would define a style that among other things would reference the font asset and material to be used by that style. This style could either be defined in the Global StyleSheet assigned in the TMP Settings or in a local StyleSheet assigned to individual text objects in the Extra Settings.

5361213--542160--upload_2020-1-11_13-11-30.png

See example “11 - The Style Tag” included in the TMP Examples & Extras to learn more about Styles and StyleSheets as well as the following video. The video is pretty old now but should give you good insight on the basics.

The newly added feature is inside of using the tag in the text itself, the Text Style feature allows you to apply it to the entire text object. This would enable you to define a style for the Headings and for the Content where these could reference different font assets and material presets as well as use any other rich text tag to change size, etc.

So take a look at the tag feature along with the Text Style and let me know if that works for your needs?

I would suggest using the latest preview release of the TMP package which is version 1.5.0-preview.3 for Unity 2018.4, version 2.1.0-preview.3 for Unity 2019.x and version 3.0.0-preview.3 for Unity 2020.x. Preview 4 should be available next week.

Thanks Stephan! That should work well. Will try it now.

I can use the font tag to set the font asset for a style in the stylesheet, but how do I set the material preset in the stylesheet? Thanks again.

Sorry - found it straight after I posted this.
For others, it’s font=“xxx” material=“xxx”

Correct.

<font=“Name of Font Asset” material=“Name of Material Preset”>