Is it possible to divide shaders or make different materials for TMP font?

Hello there, I’m Knightey (obvious, isn’t it?) and I am working on a mod that adds localization to one Unity game (Limbus Company, you might heard of it).
Actually, I mostly scavenge from Chinese localization team who are the original makers of this mod, but I modified it when it comes to fonts.
The game uses lots of shaders for the fonts, which we cannot re-create in the mod because of the limited code for the mod, yet still, I wish to make our fonts as close to the original as possible.
Now to the question itself.
Is it possible to create multiple materials for TMP font, or somehow divide some of the shaders so they could be used in different situations and not all the time?
I tried using Font Weights to “divide” them but they seem to not show the chosen shaders, and that saddens me.
Or, maybe, you know some crutches that can help me with this problem?

I may bring the url of git with the code and screenshots, if needed.

Hello Knightkey,
I usually use this solution: making material presets.

Uh-huh, thank you!
But is there a way to change these presets through code? I have no access to the unity project of the game and I doubt I will have any chance to in the nearest future.

One modder tried to help me by making a bit of code that (presumably) should use original shader presets onto the font, but here’s the problem: black underlay + black text = unreadable text, and I have no idea what to code to get rid of this problem. And also now orange outline appears in most texts; from time to time it disappears, but this still makes the game look worse.

I don't know if this will work, but I think you can write some codes by referring to the two articles below.

  1. : you can change your tmp font material presets. (sorry, It is posted in korean)
  2. : "You can change the material at runtime by simply assigning a new material via the fontSharedMaterial property." by Stephan-B

Please let me know if there is any progress after trying. (so curiouuus)

One of modders for ProjectMoon games helped me with the code and now one of the presets is working as intended!

But, unfortunately, here’s another (an old) problem:

Even though the font has Cyrillic characters (moreover, it still shows properly in some places), the text grabs the wrong font asset and this happens.

EDIT: I fixed it somehow by renaming the fonts so they wouldn’t be the same as the original ones.

1 Like